summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-06-23 20:28:22 +0530
committerDennis Francis <dennis.francis@collabora.com>2020-07-06 18:07:04 +0200
commit22d458164ae903f502e82f471c22ff8e1ebbb839 (patch)
tree495a5de65b5a1cc3dfec6e0d3eb92f32fa3106da /sc
parent345f9480618d0867f6b42a83a7ae1d62c8ef9c0c (diff)
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@gmail.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/gridwin4.cxx13
1 files changed, 12 insertions, 1 deletions
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)