summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-04 09:16:44 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-09-11 07:55:21 +0000
commit5af5c4a1038f9b0ce38716300401fda40c7fba10 (patch)
tree101c97e9c6206c917320ebd830572563dc15f6b4
parent7ea01e865114e9f46945b1d721f1360b516df7c9 (diff)
Related: tdf#92982 vcl rendercontext: optimize non-buffered paint of Cursor
Change-Id: Ic8065d4f656d42f1e2e7d8b4c602010fa0ae2d34 Reviewed-on: https://gerrit.libreoffice.org/18457 Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-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 1968a26975b3..945789ad0cf6 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()