summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-12-06 15:27:52 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-12-06 15:27:52 +0100
commit85ecac77d35f3d0a5b43cb79cadcd6f1010d7cc3 (patch)
tree7c411efd832bad19bf522e38a8e4e306f93d9791
parentca8147a714ad3a8ceb067830c5d459d06b81653d (diff)
vcl118: #i115905# improved clip region interface on SAL layer (part 4, OS2 implementation)
-rw-r--r--vcl/os2/inc/salgdi.h8
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx50
2 files changed, 23 insertions, 35 deletions
diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h
index 9ca403487c..bb8ddf8589 100644
--- a/vcl/os2/inc/salgdi.h
+++ b/vcl/os2/inc/salgdi.h
@@ -151,8 +151,6 @@ public:
virtual ~Os2SalGraphics();
protected:
- virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight );
- virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
// draw --> LineColor and FillColor and RasterOp and ClipRegion
virtual void drawPixel( long nX, long nY );
virtual void drawPixel( long nX, long nY, SalColor nSalColor );
@@ -226,11 +224,7 @@ public:
// set the clip region to empty
virtual void ResetClipRegion();
- // begin setting the clip region, add rectangles to the
- // region with the UnionClipRegion call
- virtual void BeginSetClipRegion( ULONG nCount );
- // all rectangles were added and the clip region should be set now
- virtual void EndSetClipRegion();
+ virtual bool setClipRegion( const Region& );
// set the line color to transparent (= don't draw lines)
virtual void SetLineColor();
diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx
index a445791095..7283e459b6 100644
--- a/vcl/os2/source/gdi/salgdi.cxx
+++ b/vcl/os2/source/gdi/salgdi.cxx
@@ -38,6 +38,7 @@
#ifndef _RTL_STRINGBUF_HXX
#include <rtl/strbuf.hxx>
#endif
+#include "vcl/region.h"
#ifndef __H_FT2LIB
#include <wingdi.h>
@@ -217,38 +218,29 @@ void Os2SalGraphics::ResetClipRegion()
// -----------------------------------------------------------------------
-void Os2SalGraphics::BeginSetClipRegion( ULONG nCount )
+bool Os2SalGraphics::setClipRegion( const Region& i_rClip )
{
+ ULONG nCount = i_rClip.GetRectCount();
+
mpClipRectlAry = new RECTL[ nCount ];
mnClipElementCount = 0;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL Os2SalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ];
- pClipRect->xLeft = nX;
- pClipRect->yTop = mnHeight - nY;
- pClipRect->xRight = nX + nWidth;
- pClipRect->yBottom = mnHeight - (nY + nHeight);
- mnClipElementCount++;
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-bool Os2SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-// -----------------------------------------------------------------------
-void Os2SalGraphics::EndSetClipRegion()
-{
+ 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 )
{
@@ -287,6 +279,8 @@ void Os2SalGraphics::EndSetClipRegion()
}
delete [] mpClipRectlAry;
+
+ return true;
}
// -----------------------------------------------------------------------