[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/source
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 6 16:07:38 UTC 2020
sc/source/ui/view/gridwin4.cxx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 22d458164ae903f502e82f471c22ff8e1ebbb839
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Tue Jun 23 20:28:22 2020 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Mon Jul 6 18:07:04 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 <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index b0b262f8f927..1d5d0f5d9936 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)
More information about the Libreoffice-commits
mailing list