Kaydet (Commit) af949341 authored tarafından Dmitriy Shilin's avatar Dmitriy Shilin Kaydeden (comit) Mike Kaganski

tdf#107792: vcl/win/gdi: extract Get50PercentBrush

Change-Id: If62d9f5429a78d39dc5edbe434308603b1b09fe9
Reviewed-on: https://gerrit.libreoffice.org/65307
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 20241d32
...@@ -853,6 +853,24 @@ Color WinSalGraphicsImpl::getPixel( long nX, long nY ) ...@@ -853,6 +853,24 @@ Color WinSalGraphicsImpl::getPixel( long nX, long nY )
GetBValue( aWinCol ) ); 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 ) void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags )
{ {
if ( nFlags & SalInvert::TrackFrame ) if ( nFlags & SalInvert::TrackFrame )
...@@ -871,16 +889,8 @@ void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, Sa ...@@ -871,16 +889,8 @@ void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, Sa
} }
else if ( nFlags & SalInvert::N50 ) 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 ); 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 ); PatBlt( mrParent.getHDC(), nX, nY, nWidth, nHeight, PATINVERT );
::SetTextColor( mrParent.getHDC(), nOldTextColor ); ::SetTextColor( mrParent.getHDC(), nOldTextColor );
SelectBrush( mrParent.getHDC(), hOldBrush ); SelectBrush( mrParent.getHDC(), hOldBrush );
...@@ -911,17 +921,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal ...@@ -911,17 +921,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal
{ {
if ( nSalFlags & SalInvert::N50 ) if ( nSalFlags & SalInvert::N50 )
{ hBrush = Get50PercentBrush();
SalData* pSalData = GetSalData();
if ( !pSalData->mh50Brush )
{
if ( !pSalData->mh50Bmp )
pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
}
hBrush = pSalData->mh50Brush;
}
else else
hBrush = GetStockBrush( BLACK_BRUSH ); hBrush = GetStockBrush( BLACK_BRUSH );
......
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