summaryrefslogtreecommitdiff
path: root/vcl/os2
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-23 12:46:28 +0000
committerArmin Le Grand <alg@apache.org>2012-10-23 12:46:28 +0000
commitcab10eeb7878edf224a004fd7640bd4adf8d3c51 (patch)
treeca8c7780822a571f0ade4ab1b90fc89d2c245b63 /vcl/os2
parent498926039ce717631eda046b1aa256efd24dfdf6 (diff)
#121237# Rework/Cleanup of Region code due to missing complete support for B2DPolygon class
Notes
Notes: merged as: e717d1dcce7f8906311c5ccdbb2326b61a702630
Diffstat (limited to 'vcl/os2')
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx55
1 files changed, 37 insertions, 18 deletions
diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx
index 20c6d1388e07..9bb54096732d 100644
--- a/vcl/os2/source/gdi/salgdi.cxx
+++ b/vcl/os2/source/gdi/salgdi.cxx
@@ -35,8 +35,6 @@
#include <rtl/strbuf.hxx>
#endif
-#include <region.h>
-
#ifndef __H_FT2LIB
#include <os2/wingdi.h>
#include <ft2lib.h>
@@ -217,27 +215,48 @@ void Os2SalGraphics::ResetClipRegion()
bool Os2SalGraphics::setClipRegion( const Region& i_rClip )
{
- ULONG nCount = i_rClip.GetRectCount();
-
- mpClipRectlAry = new RECTL[ nCount ];
- mnClipElementCount = 0;
+ RectangleVector aRectangles;
+ i_rClip.GetRegionRectangles(aRectangles);
+ mnClipElementCount = aRectangles.size();
+ mpClipRectlAry = 0;
- ImplRegionInfo aInfo;
- long nX, nY, nW, nH;
- bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
- while( bRegionRect )
+ if(mnClipElementCount)
{
- if ( nW && nH )
+ mpClipRectlAry = new RECTL[mnClipElementCount];
+
+ for(sal_uInt32 a(0); a < mnClipElementCount; a++)
{
- RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ];
- pClipRect->xLeft = nX;
- pClipRect->yTop = mnHeight - nY;
- pClipRect->xRight = nX + nW;
- pClipRect->yBottom = mnHeight - (nY + nH);
- mnClipElementCount++;
+ const Rectangle& rRect = aRectangles[a];
+ RECTL* pClipRect = &mpClipRectlAry[a];
+
+ pClipRect->xLeft = rRect.Left();
+ pClipRect->yTop = mnHeight - rRect.Top();
+ pClipRect->xRight = rRect.Right() + 1; // nX + nW -> L + ((R - L) + 1) -> R + 1
+ pClipRect->yBottom = mnHeight - (rRect.Bottom() + 1); // same for height
}
- bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
}
+
+// ULONG nCount = i_rClip.GetRectCount();
+//
+// mpClipRectlAry = new RECTL[ nCount ];
+// mnClipElementCount = 0;
+//
+// ImplRegionInfo aInfo;
+// long nX, nY, nW, nH;
+// bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+// while( bRegionRect )
+// {
+// if ( nW && nH )
+// {
+// RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ];
+// pClipRect->xLeft = nX;
+// pClipRect->yTop = mnHeight - nY;
+// pClipRect->xRight = nX + nW;
+// pClipRect->yBottom = mnHeight - (nY + nH);
+// mnClipElementCount++;
+// }
+// bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+// }
#ifdef SAL_PRINTER_CLIPPATH
if ( mbPrinter )
{