vcl/win/gdi/gdiimpl.cxx | 44 ++++++++++++++++++++------------------------ vcl/win/gdi/gdiimpl.hxx | 1 + 2 files changed, 21 insertions(+), 24 deletions(-)
New commits: commit 7311a88baa8c30eeb61d897f43ac3f5b481ed01f Author: Dmitriy Shilin <[email protected]> AuthorDate: Sat Dec 8 15:07:17 2018 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Dec 10 05:46:46 2018 +0100 tdf#39593 vcl/win/gdi: extract brush updating into method Change-Id: I569a8e1ce30054b2e01e9f774fe7332fa6874083 Reviewed-on: https://gerrit.libreoffice.org/64802 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 8caf2a94317f..72f2f58e524a 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -1428,21 +1428,9 @@ void WinSalGraphicsImpl::ResetPen(HPEN hNewPen) void WinSalGraphicsImpl::SetFillColor() { - // create and select new brush - HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH ); - HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hNewBrush ); - - // destroy or save old brush - if ( mhBrush ) - { - if ( !mbStockBrush ) - DeleteBrush( mhBrush ); - } - else - mrParent.mhDefBrush = hOldBrush; + ResetBrush(GetStockBrush(NULL_BRUSH)); // set new data - mhBrush = hNewBrush; mbBrush = FALSE; mbStockBrush = TRUE; } @@ -1531,23 +1519,31 @@ void WinSalGraphicsImpl::SetFillColor( Color nColor ) bStockBrush = FALSE; } - // select new brush - HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hNewBrush ); + ResetBrush(hNewBrush); - // destroy or save old brush - if ( mhBrush ) + // set new data + mnBrushColor = nBrushColor; + mbBrush = TRUE; + mbStockBrush = bStockBrush; +} + +void WinSalGraphicsImpl::ResetBrush(HBRUSH hNewBrush) +{ + HBRUSH hOldBrush = SelectBrush(mrParent.getHDC(), hNewBrush); + + if (mhBrush) { - if ( !mbStockBrush ) - DeleteBrush( mhBrush ); + if (!mbStockBrush) + { + DeleteBrush(mhBrush); + } } else + { mrParent.mhDefBrush = hOldBrush; + } - // set new data - mnBrushColor = nBrushColor; - mhBrush = hNewBrush; - mbBrush = TRUE; - mbStockBrush = bStockBrush; + mhBrush = hNewBrush; } void WinSalGraphicsImpl::SetXORMode( bool bSet, bool ) diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 040920cb1536..3673b0ca5055 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -53,6 +53,7 @@ private: void drawPixelImpl( long nX, long nY, COLORREF crColor ); void ResetPen(HPEN hNewPen); + void ResetBrush(HBRUSH hNewBrush); public: explicit WinSalGraphicsImpl(WinSalGraphics& rParent); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
