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

tdf#107792 vcl/win/gdi: introduce ScopedHRGN

Change-Id: I3d103dcb6ebb81d50bb8a10371dba7feb92c421d
Reviewed-on: https://gerrit.libreoffice.org/65924
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 7209feef
...@@ -296,9 +296,8 @@ void MakeInvisibleArea(const RECT& rSrcRect, ...@@ -296,9 +296,8 @@ void MakeInvisibleArea(const RECT& rSrcRect,
rhInvalidateRgn = CreateRectRgnIndirect(&rSrcRect); rhInvalidateRgn = CreateRectRgnIndirect(&rSrcRect);
} }
HRGN hTempRgn = CreateRectRgn(nLeft, nTop, nRight, nBottom); ScopedHRGN hTempRgn(CreateRectRgn(nLeft, nTop, nRight, nBottom));
CombineRgn(rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF); CombineRgn(rhInvalidateRgn, rhInvalidateRgn, hTempRgn.get(), RGN_DIFF);
DeleteRegion(hTempRgn);
} }
void ImplCalcOutSideRgn( const RECT& rSrcRect, void ImplCalcOutSideRgn( const RECT& rSrcRect,
...@@ -1259,9 +1258,8 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip ) ...@@ -1259,9 +1258,8 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
for( sal_uLong n = 1; n < pHeader.nCount; n++, pRect++ ) for( sal_uLong n = 1; n < pHeader.nCount; n++, pRect++ )
{ {
HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); ScopedHRGN hRgn(CreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom));
CombineRgn( mrParent.mhRegion, mrParent.mhRegion, hRgn, RGN_OR ); CombineRgn( mrParent.mhRegion, mrParent.mhRegion, hRgn.get(), RGN_OR );
DeleteRegion( hRgn );
} }
} }
} }
......
...@@ -21,7 +21,14 @@ struct HBRUSHDeleter ...@@ -21,7 +21,14 @@ struct HBRUSHDeleter
void operator()(HBRUSH hBrush) { DeleteBrush(hBrush); } void operator()(HBRUSH hBrush) { DeleteBrush(hBrush); }
}; };
struct HRGNDeleter
{
using pointer = HRGN;
void operator()(HRGN hRgn) { DeleteRegion(hRgn); }
};
using ScopedHBRUSH = std::unique_ptr<HBRUSH, HBRUSHDeleter>; using ScopedHBRUSH = std::unique_ptr<HBRUSH, HBRUSHDeleter>;
using ScopedHRGN = std::unique_ptr<HRGN, HRGNDeleter>;
#endif // INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX #endif // INCLUDED_VCL_WIN_GDI_SCOPED_GDI_HXX
......
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