sc/source/ui/view/output.cxx |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 1212811ad23f91e690245519fae0580e8e632c82
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Feb 6 18:29:31 2022 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Feb 7 10:28:29 2022 +0100

    sc: fix rendering of conditional formatting icon
    
    The bWorksInPixels flag isn't needed as it means some rendering
    information is in pixel instead of logic, but we render in logic,
    not in pixels as it is falsely assumed. So don't take into account
    the bWorksInPixels flag and just render in pixels when LOKit is
    active.
    
    Change-Id: Iba89a819a2cfa7a934ec69271923616dc22b33f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129544
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 7dd94d1b393c..1c909bb6af29 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -906,7 +906,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & 
rIconSetBitmapMap, ScIconSetType
 }
 
 void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* 
pOldIconSetInfo, const tools::Rectangle& rRect, tools::Long nOneX, tools::Long 
nOneY,
-        sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
+        sc::IconSetBitmapMap & rIconSetBitmapMap)
 {
     ScIconSetType eType = pOldIconSetInfo->eIconSetType;
     sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
@@ -916,13 +916,10 @@ void drawIconSets(vcl::RenderContext& rRenderContext, 
const ScIconSetInfo* pOldI
 
     if (pOldIconSetInfo->mnHeight)
     {
-        if (bWorksInPixels)
+        if (comphelper::LibreOfficeKit::isActive())
         {
             aHeight = rRenderContext.LogicToPixel(Size(0, 
pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height();
-            if (comphelper::LibreOfficeKit::isActive())
-            {
-                aHeight *= comphelper::LibreOfficeKit::getDPIScale();
-            }
+            aHeight *= comphelper::LibreOfficeKit::getDPIScale();
         }
         else
             aHeight = convertTwipToMm100(pOldIconSetInfo->mnHeight);
@@ -941,7 +938,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const 
ScIconSetInfo* pOldI
 void drawCells(vcl::RenderContext& rRenderContext, std::optional<Color> const 
& pColor, const SvxBrushItem* pBackground, std::optional<Color>& pOldColor, 
const SvxBrushItem*& pOldBackground,
         tools::Rectangle& rRect, tools::Long nPosX, tools::Long nLayoutSign, 
tools::Long nOneX, tools::Long nOneY, const ScDataBarInfo* pDataBarInfo, const 
ScDataBarInfo*& pOldDataBarInfo,
         const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& 
pOldIconSetInfo,
-        sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
+        sc::IconSetBitmapMap & rIconSetBitmapMap)
 {
     tools::Long nSignedOneX = nOneX * nLayoutSign;
     // need to paint if old color scale has been used and now
@@ -958,7 +955,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional<Color> const &
         if( pOldDataBarInfo )
             drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
         if( pOldIconSetInfo )
-            drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
+            drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
 
         rRect.SetLeft( nPosX - nSignedOneX );
     }
@@ -978,7 +975,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional<Color> const &
         if( pOldDataBarInfo )
             drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
         if( pOldIconSetInfo )
-            drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
+            drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
 
         rRect.SetLeft( nPosX - nSignedOneX );
     }
@@ -1141,7 +1138,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
                     if (bWorksInPixels)
                         nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 
0)).X();
 
-                    drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap(), bWorksInPixels);
+                    drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap());
 
                     // extend for all merged cells
                     nMergedCols = 1;
@@ -1165,7 +1162,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
                 if (bWorksInPixels)
                     nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 
0)).X();
 
-                drawCells(rRenderContext, std::optional<Color>(), nullptr, 
pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, 
nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap(), bWorksInPixels);
+                drawCells(rRenderContext, std::optional<Color>(), nullptr, 
pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, 
nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap());
 
                 nArrY += nSkip;
             }

Reply via email to