summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/win/gdi/gdiimpl.cxx44
-rw-r--r--vcl/win/gdi/gdiimpl.hxx1
2 files changed, 21 insertions, 24 deletions
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);