Kaydet (Commit) 8488315d authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Michael Meeks

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

Change-Id: Ic8065d4f656d42f1e2e7d8b4c602010fa0ae2d34
Reviewed-on: https://gerrit.libreoffice.org/18343Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst e576227d
...@@ -44,8 +44,11 @@ struct ImplCursorData ...@@ -44,8 +44,11 @@ struct ImplCursorData
static void ImplCursorInvert( ImplCursorData* pData ) static void ImplCursorInvert( ImplCursorData* pData )
{ {
vcl::Window* pWindow = pData->mpWindow; vcl::Window* pWindow = pData->mpWindow;
PaintBufferGuard aGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow); std::unique_ptr<PaintBufferGuard> pGuard;
vcl::RenderContext* pRenderContext = aGuard.GetRenderContext(); const bool bDoubleBuffering = pWindow->SupportsDoubleBuffering();
if (bDoubleBuffering)
pGuard.reset(new PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow));
vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow;
Rectangle aPaintRect; Rectangle aPaintRect;
bool bMapMode = pRenderContext->IsMapModeEnabled(); bool bMapMode = pRenderContext->IsMapModeEnabled();
pRenderContext->EnableMapMode( false ); pRenderContext->EnableMapMode( false );
...@@ -111,16 +114,19 @@ static void ImplCursorInvert( ImplCursorData* pData ) ...@@ -111,16 +114,19 @@ static void ImplCursorInvert( ImplCursorData* pData )
if ( pData->mnOrientation ) if ( pData->mnOrientation )
aPoly.Rotate( pData->maPixRotOff, pData->mnOrientation ); aPoly.Rotate( pData->maPixRotOff, pData->mnOrientation );
pRenderContext->Invert( aPoly, nInvertStyle ); pRenderContext->Invert( aPoly, nInvertStyle );
aPaintRect = aPoly.GetBoundRect(); if (bDoubleBuffering)
aPaintRect = aPoly.GetBoundRect();
} }
} }
else else
{ {
pRenderContext->Invert( aRect, nInvertStyle ); pRenderContext->Invert( aRect, nInvertStyle );
aPaintRect = aRect; if (bDoubleBuffering)
aPaintRect = aRect;
} }
pRenderContext->EnableMapMode( bMapMode ); pRenderContext->EnableMapMode( bMapMode );
aGuard.SetPaintRect(pRenderContext->PixelToLogic(aPaintRect)); if (bDoubleBuffering)
pGuard->SetPaintRect(pRenderContext->PixelToLogic(aPaintRect));
} }
void vcl::Cursor::ImplDraw() void vcl::Cursor::ImplDraw()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment