sc/source/ui/view/output.cxx |   35 ++++-------------------------------
 1 file changed, 4 insertions(+), 31 deletions(-)

New commits:
commit 69bf9f849234f3adb678c254b8ec7dbb5824ed8b
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Fri Mar 14 03:13:13 2025 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Fri Mar 14 13:24:19 2025 +0100

    tdf#135891 - Don't adjust x and y coordinates when working logic units
    
    Don't adjust x and y coordinates when working with logic units since the
    repaint process will redraw the background and grid again using pixels.
    Otherwise, this would lead to an offset between the grid (pixels) and
    the background of the cells (logic units).
    
    Change-Id: I224bb9e50b80f3a54ed1403e465eecd4cb317581
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182890
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index cc4a3bd6e2b4..bfac94a70f59 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1083,17 +1083,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
     tools::Long nOneYLogic = aOnePixel.Height();
 
     // See more about bWorksInPixels in ScOutputData::DrawGrid
-    bool bWorksInPixels = false;
-    if (eType == OUTTYPE_WINDOW)
-        bWorksInPixels = true;
-
-    tools::Long nOneX = 1;
-    tools::Long nOneY = 1;
-    if (!bWorksInPixels)
-    {
-        nOneX = nOneXLogic;
-        nOneY = nOneYLogic;
-    }
+    bool bWorksInPixels = (eType == OUTTYPE_WINDOW);
 
     tools::Rectangle aRect;
 
@@ -1143,9 +1133,9 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
                 tools::Long nPosX = nScrX;
 
                 if ( bLayoutRTL )
-                    nPosX += nMirrorW - nOneX;
+                    nPosX += nMirrorW - 1;
 
-                aRect = tools::Rectangle(nPosX, nPosY - nOneY, nPosX, nPosY - 
nOneY + nRowHeight);
+                aRect = tools::Rectangle(nPosX, nPosY - 1, nPosX, nPosY - 1 + 
nRowHeight);
                 if (bWorksInPixels)
                     aRect = rRenderContext.PixelToLogic(aRect); // internal 
data in pixels, but we'll be drawing in logic units
 
@@ -2388,23 +2378,6 @@ void ScOutputData::DrawChangeTrack()
 
 void ScOutputData::DrawSparklines(vcl::RenderContext& rRenderContext)
 {
-    Size aOnePixel = rRenderContext.PixelToLogic(Size(1,1));
-    tools::Long nOneXLogic = aOnePixel.Width();
-    tools::Long nOneYLogic = aOnePixel.Height();
-
-    // See more about bWorksInPixels in ScOutputData::DrawGrid
-    bool bWorksInPixels = false;
-    if (eType == OUTTYPE_WINDOW)
-        bWorksInPixels = true;
-
-    tools::Long nOneX = 1;
-    tools::Long nOneY = 1;
-    if (!bWorksInPixels)
-    {
-        nOneX = nOneXLogic;
-        nOneY = nOneYLogic;
-    }
-
     tools::Long nInitPosX = nScrX;
     if ( bLayoutRTL )
         nInitPosX += nMirrorW - 1;              // always in pixels
@@ -2445,7 +2418,7 @@ void ScOutputData::DrawSparklines(vcl::RenderContext& 
rRenderContext)
                     Size aSize(nWidth, nHeight);
 
                     sc::SparklineRenderer renderer(*mpDoc);
-                    renderer.render(pSparkline, rRenderContext, 
tools::Rectangle(aPoint, aSize), nOneX, nOneY, double(aZoomX), double(aZoomY));
+                    renderer.render(pSparkline, rRenderContext, 
tools::Rectangle(aPoint, aSize), 1, 1, double(aZoomX), double(aZoomY));
                 }
 
                 nPosX += pRowInfo[0].basicCellInfo(nX).nWidth * nLayoutSign;

Reply via email to