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

tdf#107792 vcl/win: introduce ScopedSelectedHBRUSH

Change-Id: I39792ce8442f9e7776b44a489b3c15b908e2f773
Reviewed-on: https://gerrit.libreoffice.org/66253
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 2a1ea372
...@@ -50,6 +50,7 @@ private: ...@@ -50,6 +50,7 @@ private:
using ScopedSelectedHPEN = ScopedSelectedGDI<ScopedHPEN, SelectPen>; using ScopedSelectedHPEN = ScopedSelectedGDI<ScopedHPEN, SelectPen>;
using ScopedSelectedHFONT = ScopedSelectedGDI<ScopedHFONT, SelectFont>; using ScopedSelectedHFONT = ScopedSelectedGDI<ScopedHFONT, SelectFont>;
using ScopedSelectedHBRUSH = ScopedSelectedGDI<ScopedHBRUSH, SelectBrush>;
#endif // INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX #endif // INCLUDED_VCL_INC_WIN_SCOPED_GDI_HXX
......
...@@ -778,10 +778,9 @@ void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, ...@@ -778,10 +778,9 @@ void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry,
SalTwoRect aPosAry = rPosAry; SalTwoRect aPosAry = rPosAry;
const HDC hDC = mrParent.getHDC(); const HDC hDC = mrParent.getHDC();
ScopedHBRUSH hMaskBrush(CreateSolidBrush(RGB(nMaskColor.GetRed(), ScopedSelectedHBRUSH(hDC, CreateSolidBrush(RGB(nMaskColor.GetRed(),
nMaskColor.GetGreen(), nMaskColor.GetGreen(),
nMaskColor.GetBlue()))); nMaskColor.GetBlue())));
HBRUSH hOldBrush = SelectBrush(hDC, hMaskBrush.get());
// WIN/WNT seems to have a minor problem mapping the correct color of the // WIN/WNT seems to have a minor problem mapping the correct color of the
// mask to the palette if we draw the DIB directly ==> draw DDB // mask to the palette if we draw the DIB directly ==> draw DDB
...@@ -794,8 +793,6 @@ void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, ...@@ -794,8 +793,6 @@ void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry,
} }
else else
ImplDrawBitmap( hDC, aPosAry, rSalBitmap, false, 0x00B8074AUL ); ImplDrawBitmap( hDC, aPosAry, rSalBitmap, false, 0x00B8074AUL );
SelectBrush(hDC, hOldBrush);
} }
std::shared_ptr<SalBitmap> WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY ) std::shared_ptr<SalBitmap> WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY )
...@@ -1574,10 +1571,8 @@ void WinSalGraphicsImpl::DrawPixelImpl( long nX, long nY, COLORREF crColor ) ...@@ -1574,10 +1571,8 @@ void WinSalGraphicsImpl::DrawPixelImpl( long nX, long nY, COLORREF crColor )
return; return;
} }
ScopedHBRUSH hBrush(CreateSolidBrush(crColor)); ScopedSelectedHBRUSH(hDC, CreateSolidBrush(crColor));
HBRUSH hOldBrush = SelectBrush(hDC, hBrush.get());
PatBlt(hDC, static_cast<int>(nX), static_cast<int>(nY), int(1), int(1), PATINVERT); PatBlt(hDC, static_cast<int>(nX), static_cast<int>(nY), int(1), int(1), PATINVERT);
SelectBrush(hDC, hOldBrush);
} }
void WinSalGraphicsImpl::drawPixel( long nX, long nY ) void WinSalGraphicsImpl::drawPixel( long nX, long nY )
......
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