[Libreoffice-commits] core.git: vcl/win
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Dec 7 10:23:49 UTC 2018
vcl/win/gdi/gdiimpl.cxx | 55 ++++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 27 deletions(-)
New commits:
commit af4fab260b4e5e6cd073d449081dd057b9715881
Author: Dmitriy Shilin <dshil at fastmail.com>
AuthorDate: Fri Dec 7 10:45:14 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Dec 7 11:23:18 2018 +0100
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 at collabora.com>
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,
More information about the Libreoffice-commits
mailing list