summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorDmitriy Shilin <dshil@fastmail.com>2019-01-07 01:10:27 -0800
committerMike Kaganski <mike.kaganski@collabora.com>2019-01-18 16:39:03 +0100
commit643edcb11d635e09042d82d191279b6b1c2f25a9 (patch)
tree5655bc549d94c659b933ea565d050d0017f92ac1 /vcl/win
parent74b23279c342f2484cdad64b211fb1972644d5a5 (diff)
tdf#107792 vcl/win: introduce ScopedHBITMAP
Change-Id: I2af507d9b924644d3a0e8a4bf2e92ca4b8a9a1b4 Reviewed-on: https://gerrit.libreoffice.org/65929 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/gdiimpl.cxx20
1 files changed, 7 insertions, 13 deletions
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index e5013631d9ed..a9406729fa21 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -678,17 +678,18 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
int nDstWidth = static_cast<int>(aPosAry.mnDestWidth);
int nDstHeight = static_cast<int>(aPosAry.mnDestHeight);
HDC hDC = mrParent.getHDC();
- HBITMAP hMemBitmap = nullptr;
- HBITMAP hMaskBitmap = nullptr;
+
+ ScopedHBITMAP hMemBitmap;
+ ScopedHBITMAP hMaskBitmap;
if( ( nDstWidth > CACHED_HDC_DEFEXT ) || ( nDstHeight > CACHED_HDC_DEFEXT ) )
{
- hMemBitmap = CreateCompatibleBitmap( hDC, nDstWidth, nDstHeight );
- hMaskBitmap = CreateCompatibleBitmap( hDC, nDstWidth, nDstHeight );
+ hMemBitmap.reset(CreateCompatibleBitmap(hDC, nDstWidth, nDstHeight));
+ hMaskBitmap.reset(CreateCompatibleBitmap(hDC, nDstWidth, nDstHeight));
}
- HDC hMemDC = ImplGetCachedDC( CACHED_HDC_1, hMemBitmap );
- HDC hMaskDC = ImplGetCachedDC( CACHED_HDC_2, hMaskBitmap );
+ HDC hMemDC = ImplGetCachedDC( CACHED_HDC_1, hMemBitmap.get() );
+ HDC hMaskDC = ImplGetCachedDC( CACHED_HDC_2, hMaskBitmap.get() );
aPosAry.mnDestX = aPosAry.mnDestY = 0;
BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hDC, nDstX, nDstY, SRCCOPY );
@@ -729,13 +730,6 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
ImplReleaseCachedDC( CACHED_HDC_1 );
ImplReleaseCachedDC( CACHED_HDC_2 );
-
- // hMemBitmap != 0 ==> hMaskBitmap != 0
- if( hMemBitmap )
- {
- DeleteObject( hMemBitmap );
- DeleteObject( hMaskBitmap );
- }
}
bool WinSalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth,