diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2020-06-23 20:28:22 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2020-07-11 07:34:27 +0200 |
commit | 390ea54b54003845cef59622c2a4705824555096 (patch) | |
tree | b45a2e45d6afd3eb9a4085f2636b60088cbe341d /sc | |
parent | a910703bcbd2d8a767aff3f50185233baf601a32 (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>
(cherry picked from commit 22d458164ae903f502e82f471c22ff8e1ebbb839)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98162
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
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) |