summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorDmitriy Shilin <dshil@fastmail.com>2018-12-07 10:45:14 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-12-07 11:23:18 +0100
commitaf4fab260b4e5e6cd073d449081dd057b9715881 (patch)
tree9df83de4b70c487866303110612ab953ce056768 /vcl
parent2ee6993007fc5160f73b7e560f6825fcecd0447e (diff)
tdf#39593 vcl: reduce copy-paste in ImplCalcOutSideRgn
Change-Id: I13e13e5e17815bbffef6132ed28fadd3fb12f99b Reviewed-on: https://gerrit.libreoffice.org/64750 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/gdi/gdiimpl.cxx55
1 files changed, 28 insertions, 27 deletions
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index fbb36b16ffe2..b2879686d9a7 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -344,47 +344,48 @@ void WinSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcG
}
}
-static void ImplCalcOutSideRgn( const RECT& rSrcRect,
+namespace
+{
+
+void MakeInvisibleArea(const RECT& rSrcRect,
+ int nLeft, int nTop, int nRight, int nBottom,
+ HRGN& rhInvalidateRgn)
+{
+ if (!rhInvalidateRgn)
+ {
+ rhInvalidateRgn = CreateRectRgnIndirect(&rSrcRect);
+ }
+
+ HRGN hTempRgn = CreateRectRgn(nLeft, nTop, nRight, nBottom);
+ CombineRgn(rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF);
+ DeleteRegion(hTempRgn);
+}
+
+void ImplCalcOutSideRgn( const RECT& rSrcRect,
int nLeft, int nTop, int nRight, int nBottom,
HRGN& rhInvalidateRgn )
{
- HRGN hTempRgn;
-
// calculate area outside the visible region
- if ( rSrcRect.left < nLeft )
+ if (rSrcRect.left < nLeft)
{
- if ( !rhInvalidateRgn )
- rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
- hTempRgn = CreateRectRgn( -31999, 0, nLeft, 31999 );
- CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
- DeleteRegion( hTempRgn );
+ MakeInvisibleArea(rSrcRect, -31999, 0, nLeft, 31999, rhInvalidateRgn);
}
- if ( rSrcRect.top < nTop )
+ if (rSrcRect.top < nTop)
{
- if ( !rhInvalidateRgn )
- rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
- hTempRgn = CreateRectRgn( 0, -31999, 31999, nTop );
- CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
- DeleteRegion( hTempRgn );
+ MakeInvisibleArea(rSrcRect, 0, -31999, 31999, nTop, rhInvalidateRgn);
}
- if ( rSrcRect.right > nRight )
+ if (rSrcRect.right > nRight)
{
- if ( !rhInvalidateRgn )
- rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
- hTempRgn = CreateRectRgn( nRight, 0, 31999, 31999 );
- CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
- DeleteRegion( hTempRgn );
+ MakeInvisibleArea(rSrcRect, nRight, 0, 31999, 31999, rhInvalidateRgn);
}
- if ( rSrcRect.bottom > nBottom )
+ if (rSrcRect.bottom > nBottom)
{
- if ( !rhInvalidateRgn )
- rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
- hTempRgn = CreateRectRgn( 0, nBottom, 31999, 31999 );
- CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
- DeleteRegion( hTempRgn );
+ MakeInvisibleArea(rSrcRect, 0, nBottom, 31999, 31999, rhInvalidateRgn);
}
}
+} // namespace
+
void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY,
long nSrcX, long nSrcY,
long nSrcWidth, long nSrcHeight,