[Libreoffice-commits] core.git: vcl/win

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 24 09:16:45 UTC 2018


 vcl/win/gdi/gdiimpl.cxx |   40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

New commits:
commit af9493419e103cff3b8b006c6d41613c42df8a49
Author:     Dmitriy Shilin <dshil at fastmail.com>
AuthorDate: Tue Dec 18 10:06:17 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Dec 24 10:16:26 2018 +0100

    tdf#107792: vcl/win/gdi: extract Get50PercentBrush
    
    Change-Id: If62d9f5429a78d39dc5edbe434308603b1b09fe9
    Reviewed-on: https://gerrit.libreoffice.org/65307
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index e99e84bc4030..50238bf801a9 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -853,6 +853,24 @@ Color WinSalGraphicsImpl::getPixel( long nX, long nY )
                               GetBValue( aWinCol ) );
 }
 
+namespace
+{
+
+HBRUSH Get50PercentBrush()
+{
+    SalData* pSalData = GetSalData();
+    if ( !pSalData->mh50Brush )
+    {
+        if ( !pSalData->mh50Bmp )
+            pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
+        pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
+    }
+
+    return pSalData->mh50Brush;
+}
+
+} // namespace
+
 void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags )
 {
     if ( nFlags & SalInvert::TrackFrame )
@@ -871,16 +889,8 @@ void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, Sa
     }
     else if ( nFlags & SalInvert::N50 )
     {
-        SalData* pSalData = GetSalData();
-        if ( !pSalData->mh50Brush )
-        {
-            if ( !pSalData->mh50Bmp )
-                pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
-            pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
-        }
-
         COLORREF nOldTextColor = ::SetTextColor( mrParent.getHDC(), 0 );
-        HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), pSalData->mh50Brush );
+        HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), Get50PercentBrush() );
         PatBlt( mrParent.getHDC(), nX, nY, nWidth, nHeight, PATINVERT );
         ::SetTextColor( mrParent.getHDC(), nOldTextColor );
         SelectBrush( mrParent.getHDC(), hOldBrush );
@@ -911,17 +921,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal
     {
 
         if ( nSalFlags & SalInvert::N50 )
-        {
-            SalData* pSalData = GetSalData();
-            if ( !pSalData->mh50Brush )
-            {
-                if ( !pSalData->mh50Bmp )
-                    pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
-                pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
-            }
-
-            hBrush = pSalData->mh50Brush;
-        }
+            hBrush = Get50PercentBrush();
         else
             hBrush = GetStockBrush( BLACK_BRUSH );
 


More information about the Libreoffice-commits mailing list