sc/source/ui/view/gridwin4.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit 390ea54b54003845cef59622c2a4705824555096 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Tue Jun 23 20:28:22 2020 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Sat Jul 11 07:34:27 2020 +0200 reset all draw gridOffsets when zoom needs to change... so that these are recalculated on render, else the shape positions in the tiles will be wrong. It is not enough to reset for just the objects in the tile because the render code iterates over all objects and then decide whether to render them based on the position/size. An obvious optimization is to choose a view/window with its zoom matching the tile-request using some useful heuristic and avoid a linear scan of views. Change-Id: Iffa96d261bc3362af3a528fbf7d4d3bcafc6d497 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98167 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> (cherry picked from commit 22d458164ae903f502e82f471c22ff8e1ebbb839) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98162 Tested-by: Jenkins diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 5054b8745889..1f305e35f057 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1337,10 +1337,16 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); - // FIXME: compare vs. origZoomX/Y and avoid ? + const bool bChangeZoom = (aFracX != origZoomX || aFracY != origZoomY); // page break zoom, and aLogicMode in ScViewData + // FIXME: there are issues when SetZoom is called conditionally. pViewData->SetZoom(aFracX, aFracY, true); + if (bChangeZoom) + { + if (ScDrawView* pDrawView = pViewData->GetScDrawView()) + pDrawView->resetGridOffsetsForAllSdrPageViews(); + } const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth; const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight; @@ -1452,6 +1458,11 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, pDoc->PrepareFormulaCalc(); pViewData->SetZoom(origZoomX, origZoomY, true); + if (bChangeZoom) + { + if (ScDrawView* pDrawView = pViewData->GetScDrawView()) + pDrawView->resetGridOffsetsForAllSdrPageViews(); + } } void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits