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:56:01 +0000
commit8488315d565a061749546df27d2507d0927a8993 (patch)
tree2cc696a5821037bd0c2d539739974bade611ef16
parente576227d71788409110108281340005638f78bf1 (diff)
Related: tdf#92982 vcl rendercontext: optimize non-buffered paint of Cursor
Change-Id: Ic8065d4f656d42f1e2e7d8b4c602010fa0ae2d34 Reviewed-on: https://gerrit.libreoffice.org/18343 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()