sc/source/ui/view/gridwin4.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 4e91e24ced90d7617bbfbc076e47a0896151260e
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri May 13 17:06:19 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue May 17 21:18:04 2022 +0200

    lok: respect zoom in calc tile rendering of EditView
    
    Issue was that when using 150% zoom in LOK and editing
    some textbox inside Calc spreadsheet - we didn't see
    content of it (but tiles were invalidated).
    In other view we have seen textbox in correct place
    if zoom was 100%.
    
    To fix that we need to pass zoom factor and use it.
    
    Change-Id: Ib1cf49af02d0637e09ce68c5c2c41ffb3014c701
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134437
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a12b190933bb..af87b086ca7c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -730,7 +730,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const 
ScTableInfo& rTableI
         // the same as editeng and drawinglayer), and get rid of all the
         // SetMapMode's and other unnecessary fun we have with pixels
         // See also ScGridWindow::GetDrawMapMode() for the rest of this hack
-        aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
+        aDrawMode.SetOrigin(PixelToLogic(Point(tools::Long(nScrX / 
aOutputData.aZoomX),
+                                               tools::Long(nScrY / 
aOutputData.aZoomY)), aDrawMode));
     }
     tools::Rectangle aDrawingRectLogic;
     bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
@@ -1038,6 +1039,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
 
             if (bIsTiledRendering)
             {
+                const double fZoomX = static_cast<double>(aOutputData.aZoomX);
+                const double fZoomY = static_cast<double>(aOutputData.aZoomY);
+
                 Point aOrigin = aOriginalMode.GetOrigin();
                 if (bLayoutRTL)
                     aOrigin.setX(-o3tl::convert(aOrigin.getX(), 
o3tl::Length::twip, o3tl::Length::px)
@@ -1049,8 +1053,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
                 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, 
o3tl::Length::px)
                              + aOutputData.nScrY);
                 const double twipFactor = 15 * 1.76388889; // 26.45833335
-                aOrigin = Point(aOrigin.getX() * twipFactor,
-                                aOrigin.getY() * twipFactor);
+                aOrigin = Point(aOrigin.getX() * twipFactor / fZoomX,
+                                aOrigin.getY() * twipFactor / fZoomY);
                 MapMode aNew = rDevice.GetMapMode();
                 aNew.SetOrigin(aOrigin);
                 rDevice.SetMapMode(aNew);
@@ -1601,7 +1605,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
                              -nTopLeftTileRowOffset,
                              nTopLeftTileCol, nTopLeftTileRow,
                              nBottomRightTileCol, nBottomRightTileRow,
-                             fPPTX, fPPTY, nullptr, nullptr);
+                             fPPTX, fPPTY, &aFracX, &aFracY);
 
     // setup the SdrPage so that drawinglayer works correctly
     ScDrawLayer* pModel = rDoc.GetDrawLayer();

Reply via email to