summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-04 09:16:44 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-04 09:56:01 +0200
commit012a7115d11c6bc2f4c3c33180c319d043a22d51 (patch)
tree070085a0a190a497184f05ef888d2a1e305e045f
parent927d35c97afb88f17a465ddbb87541ac7ba93b65 (diff)
Related: tdf#92982 vcl rendercontext: optimize non-buffered paint of Cursor
Change-Id: Ic8065d4f656d42f1e2e7d8b4c602010fa0ae2d34
-rw-r--r--vcl/source/window/cursor.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 3b75897903c7..5a01d10e676a 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()