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

New commits:
commit 2f5b91c4fd99dd13dacfc9ee675ddd2f32cf7b8c
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Feb 6 18:30:39 2022 +0900
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Sat Nov 12 15:19:37 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: I3703d459a2d1444c397f2d9e97af9f0d3010d544
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129546
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit d0a11f591a57754362bb86c4bb07869bc18e5f75)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142609
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 1b40ae0b4b62..d2a65bac6df0 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -910,7 +910,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;
@@ -920,16 +920,15 @@ 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 = o3tl::convert(pOldIconSetInfo->mnHeight, 
o3tl::Length::twip, o3tl::Length::mm100);
+        }
     }
 
     Size aSize = rIcon.GetSizePixel();
@@ -945,7 +944,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
@@ -962,7 +961,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 );
     }
@@ -982,7 +981,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 );
     }
@@ -1166,7 +1165,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());
 
                     nPosX = nNewPosX;
                 }
@@ -1175,7 +1174,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