[Libreoffice-commits] core.git: vcl/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Sep 4 00:56:39 PDT 2015


 vcl/source/window/cursor.cxx |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 012a7115d11c6bc2f4c3c33180c319d043a22d51
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 4 09:16:44 2015 +0200

    Related: tdf#92982 vcl rendercontext: optimize non-buffered paint of Cursor
    
    Change-Id: Ic8065d4f656d42f1e2e7d8b4c602010fa0ae2d34

diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 3b75897..5a01d10 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -44,8 +44,11 @@ struct ImplCursorData
 static void ImplCursorInvert( ImplCursorData* pData )
 {
     vcl::Window* pWindow  = pData->mpWindow;
-    PaintBufferGuard aGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow);
-    vcl::RenderContext* pRenderContext = aGuard.GetRenderContext();
+    std::unique_ptr<PaintBufferGuard> pGuard;
+    const bool bDoubleBuffering = pWindow->SupportsDoubleBuffering();
+    if (bDoubleBuffering)
+        pGuard.reset(new PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow));
+    vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow;
     Rectangle aPaintRect;
     bool    bMapMode = pRenderContext->IsMapModeEnabled();
     pRenderContext->EnableMapMode( false );
@@ -111,16 +114,19 @@ static void ImplCursorInvert( ImplCursorData* pData )
             if ( pData->mnOrientation )
                 aPoly.Rotate( pData->maPixRotOff, pData->mnOrientation );
             pRenderContext->Invert( aPoly, nInvertStyle );
-            aPaintRect = aPoly.GetBoundRect();
+            if (bDoubleBuffering)
+                aPaintRect = aPoly.GetBoundRect();
         }
     }
     else
     {
         pRenderContext->Invert( aRect, nInvertStyle );
-        aPaintRect = aRect;
+        if (bDoubleBuffering)
+            aPaintRect = aRect;
     }
     pRenderContext->EnableMapMode( bMapMode );
-    aGuard.SetPaintRect(pRenderContext->PixelToLogic(aPaintRect));
+    if (bDoubleBuffering)
+        pGuard->SetPaintRect(pRenderContext->PixelToLogic(aPaintRect));
 }
 
 void vcl::Cursor::ImplDraw()


More information about the Libreoffice-commits mailing list