svx/source/svdraw/sdrpagewindow.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 69ef42fedda05b2eca65883ebc8e2db4c5811001
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Mon Jan 17 11:36:24 2022 +0530
Commit:     Dennis Francis <dennis.fran...@collabora.com>
CommitDate: Sun Feb 6 11:11:41 2022 +0100

    svx-lok: incomplete invalidation when resizing/deleting...
    
    shapes in writer. The problematic commit is
    
    5e37acbaaa0b0891829907331ecacd2d3b67526d
    lokCalcRTL: shapes: do not send negative(X) invalidations
    
    The above change forced the lok mode to use the second branch hence avoid 
the
    view-transformation based invalidation. This patch restores the old
    branching condition, but do the negation of invalidation rectangle in
    case of lok-calc-rtl mode(IsNegativeX).
    
    Change-Id: I679473f0610d2edabeb6071edbb32a63a436d053
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128491
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    (cherry picked from commit 242d2752aa6af2c52affc90e84b58c59c5fa779d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129440
    Tested-by: Jenkins
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.com>

diff --git a/svx/source/svdraw/sdrpagewindow.cxx 
b/svx/source/svdraw/sdrpagewindow.cxx
index 5facfc45d237..01be77135674 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -430,8 +430,7 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId,
 // Invalidate call, used from ObjectContact(OfPageView) in 
InvalidatePartOfView(...)
 void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
 {
-    bool bLOKActive = comphelper::LibreOfficeKit::isActive();
-    if (!bLOKActive && GetPageView().IsVisible() && 
GetPaintWindow().OutputToWindow())
+    if (GetPageView().IsVisible() && GetPaintWindow().OutputToWindow())
     {
         OutputDevice& rWindow(GetPaintWindow().GetOutputDevice());
         basegfx::B2DRange aDiscreteRange(rRange);
@@ -444,10 +443,14 @@ void SdrPageWindow::InvalidatePageWindow(const 
basegfx::B2DRange& rRange)
             aDiscreteRange.grow(1.0);
         }
 
+        // If the shapes use negative X coordinates, make them positive before 
sending
+        // the invalidation rectangle.
+        bool bNegativeX = mpImpl->mrPageView.GetView().IsNegativeX();
+
         const tools::Rectangle aVCLDiscreteRectangle(
-            static_cast<tools::Long>(floor(aDiscreteRange.getMinX())),
+            static_cast<tools::Long>(bNegativeX ? std::max(0.0, 
ceil(-aDiscreteRange.getMaxX())) : floor(aDiscreteRange.getMinX())),
             static_cast<tools::Long>(floor(aDiscreteRange.getMinY())),
-            static_cast<tools::Long>(ceil(aDiscreteRange.getMaxX())),
+            static_cast<tools::Long>(bNegativeX ? std::max(0.0, 
floor(-aDiscreteRange.getMinX())) : ceil(aDiscreteRange.getMaxX())),
             static_cast<tools::Long>(ceil(aDiscreteRange.getMaxY())));
 
         const bool bWasMapModeEnabled(rWindow.IsMapModeEnabled());
@@ -455,7 +458,7 @@ void SdrPageWindow::InvalidatePageWindow(const 
basegfx::B2DRange& rRange)
         GetPageView().GetView().InvalidateOneWin(rWindow, 
aVCLDiscreteRectangle);
         rWindow.EnableMapMode(bWasMapModeEnabled);
     }
-    else if (bLOKActive)
+    else if (comphelper::LibreOfficeKit::isActive())
     {
         // we don't really have to have a paint window with LOK; OTOH we know
         // that the drawinglayer units are 100ths of mm, so they are easy to

Reply via email to