[Libreoffice-commits] core.git: Branch 'feature/fixes10' - vcl/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Sep 9 16:53:54 PDT 2015
vcl/source/window/cursor.cxx | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 8912ae06a370a5d4927846af75203fe77ba657f7
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 1968a26..945789a 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