vcl/source/window/paint.cxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 96880f5af713a55d87556af30a08b5f09f00ba48
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 23 17:29:56 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Nov 23 21:13:50 2022 +0100

    tdf#152094 don't attempt scroll paint optimization for devices with a 
mapmode
    
    Change-Id: I446cf9ee62faf564143d25db60643c9b6cd8e3d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143188
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 40172ade6a9e..a70f1c0e4004 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1645,6 +1645,12 @@ void Window::ImplScroll( const tools::Rectangle& rRect,
     if ( !nHorzScroll && !nVertScroll )
         return;
 
+    // There will be no CopyArea() call below, so invalidate the whole visible
+    // area, not only the smaller one that was just scrolled in.
+    // Do this when we have a double buffer anyway, or (tdf#152094) the device 
has a map mode enabled which
+    // makes the conversion to pixel inaccurate
+    const bool bCopyExistingAreaAndElideInvalidate = 
!SupportsDoubleBuffering() && !GetOutDev()->IsMapModeEnabled();
+
     if ( mpWindowImpl->mpCursor )
         mpWindowImpl->mpCursor->ImplSuspend();
 
@@ -1692,13 +1698,8 @@ void Window::ImplScroll( const tools::Rectangle& rRect,
     tools::Rectangle aDestRect(aRectMirror);
     aDestRect.Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
     vcl::Region aWinInvalidateRegion(aRectMirror);
-    if (!SupportsDoubleBuffering())
-    {
-        // There will be no CopyArea() call below, so invalidate the
-        // whole visible area, not only the smaller one that was just
-        // scrolled in.
+    if (bCopyExistingAreaAndElideInvalidate)
         aWinInvalidateRegion.Exclude(aDestRect);
-    }
 
     aInvalidateRegion.Union(aWinInvalidateRegion);
 
@@ -1743,7 +1744,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect,
         SalGraphics* pGraphics = ImplGetFrameGraphics();
         // The invalidation area contains the area what would be copied here,
         // so avoid copying in case of double buffering.
-        if (pGraphics && !SupportsDoubleBuffering())
+        if (pGraphics && bCopyExistingAreaAndElideInvalidate)
         {
             if( bReMirror )
             {

Reply via email to