summaryrefslogtreecommitdiff
path: root/vcl/unx/generic
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/unx/generic
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/unx/generic')
-rw-r--r--vcl/unx/generic/gdi/pspgraphics.cxx42
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx49
2 files changed, 69 insertions, 22 deletions
diff --git a/vcl/unx/generic/gdi/pspgraphics.cxx b/vcl/unx/generic/gdi/pspgraphics.cxx
index 188cff6be9dd..f0a010d815c5 100644
--- a/vcl/unx/generic/gdi/pspgraphics.cxx
+++ b/vcl/unx/generic/gdi/pspgraphics.cxx
@@ -46,7 +46,6 @@
#include "outfont.hxx"
#include "fontsubset.hxx"
#include "salprn.hxx"
-#include "region.h"
#ifdef ENABLE_GRAPHITE
#include <graphite_layout.hxx>
@@ -295,20 +294,45 @@ void PspGraphics::ResetClipRegion()
bool PspGraphics::setClipRegion( const Region& i_rClip )
{
// TODO: support polygonal clipregions here
- m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() );
+ RectangleVector aRectangles;
+ i_rClip.GetRegionRectangles(aRectangles);
+ m_pPrinterGfx->BeginSetClipRegion(aRectangles.size());
- ImplRegionInfo aInfo;
- long nX, nY, nW, nH;
- bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
- while( bRegionRect )
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
{
- if ( nW && nH )
+ const long nW(aRectIter->GetWidth());
+
+ if(nW)
{
- m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH );
+ const long nH(aRectIter->GetHeight());
+
+ if(nH)
+ {
+ m_pPrinterGfx->UnionClipRegion(
+ aRectIter->Left(),
+ aRectIter->Top(),
+ nW,
+ nH);
+ }
}
- bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
}
+
m_pPrinterGfx->EndSetClipRegion();
+
+ //m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() );
+ //
+ //ImplRegionInfo aInfo;
+ //long nX, nY, nW, nH;
+ //bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ //while( bRegionRect )
+ //{
+ // if ( nW && nH )
+ // {
+ // m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH );
+ // }
+ // bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ //}
+ //m_pPrinterGfx->EndSetClipRegion();
return true;
}
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index d7a3eccb0d09..cda1c27fc98a 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -49,7 +49,6 @@
#include "printergfx.hxx"
#include "xrender_peer.hxx"
-#include "region.h"
#include <vector>
#include <queue>
@@ -591,24 +590,48 @@ bool X11SalGraphics::setClipRegion( const Region& i_rClip )
XDestroyRegion( mpClipRegion );
mpClipRegion = XCreateRegion();
- ImplRegionInfo aInfo;
- long nX, nY, nW, nH;
- bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
- while( bRegionRect )
+ RectangleVector aRectangles;
+ i_rClip.GetRegionRectangles(aRectangles);
+
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
{
- if ( nW && nH )
+ const long nW(aRectIter->GetWidth());
+
+ if(nW)
{
- XRectangle aRect;
- aRect.x = (short)nX;
- aRect.y = (short)nY;
- aRect.width = (unsigned short)nW;
- aRect.height = (unsigned short)nH;
+ const long nH(aRectIter->GetHeight());
+
+ if(nH)
+ {
+ XRectangle aRect;
- XUnionRectWithRegion( &aRect, mpClipRegion, mpClipRegion );
+ aRect.x = (short)aRectIter->Left();
+ aRect.y = (short)aRectIter->Top();
+ aRect.width = (unsigned short)nW;
+ aRect.height = (unsigned short)nH;
+ XUnionRectWithRegion(&aRect, mpClipRegion, mpClipRegion);
+ }
}
- bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
}
+ //ImplRegionInfo aInfo;
+ //long nX, nY, nW, nH;
+ //bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
+ //while( bRegionRect )
+ //{
+ // if ( nW && nH )
+ // {
+ // XRectangle aRect;
+ // aRect.x = (short)nX;
+ // aRect.y = (short)nY;
+ // aRect.width = (unsigned short)nW;
+ // aRect.height = (unsigned short)nH;
+ //
+ // XUnionRectWithRegion( &aRect, mpClipRegion, mpClipRegion );
+ // }
+ // bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ //}
+
// done, invalidate GCs
bPenGC_ = sal_False;
bFontGC_ = sal_False;