summaryrefslogtreecommitdiff
path: root/vcl/unx
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
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')
-rw-r--r--vcl/unx/generic/gdi/pspgraphics.cxx42
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx49
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx27
-rw-r--r--vcl/unx/headless/svpgdi.cxx66
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx39
5 files changed, 167 insertions, 56 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;
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 41c1a95feac3..eac3312a3a7f 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -760,16 +760,29 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType,
}
else
{
- RegionHandle aHdl = aClipRegion.BeginEnumRects();
- Rectangle aPaintRect;
- while( aClipRegion.GetNextEnumRect( aHdl, aPaintRect ) )
+ RectangleVector aRectangles;
+ aClipRegion.GetRegionRectangles(aRectangles);
+
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
{
- aPaintRect = aCtrlRect.GetIntersection( aPaintRect );
- if( aPaintRect.IsEmpty() )
+ if(aRectIter->IsEmpty())
+ {
continue;
- aClip.push_back( aPaintRect );
+ }
+
+ aClip.push_back(*aRectIter);
}
- aClipRegion.EndEnumRects( aHdl );
+
+ //RegionHandle aHdl = aClipRegion.BeginEnumRects();
+ //Rectangle aPaintRect;
+ //while( aClipRegion.GetEnumRects( aHdl, aPaintRect ) )
+ //{
+ // aPaintRect = aCtrlRect.GetIntersection( aPaintRect );
+ // if( aPaintRect.IsEmpty() )
+ // continue;
+ // aClip.push_back( aPaintRect );
+ //}
+ //aClipRegion.EndEnumRects( aHdl );
}
if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) )
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index c3f4ce549e1e..5360e71a41ea 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -42,7 +42,6 @@
#endif
#include <svppspgraphics.hxx>
-#include <region.h>
using namespace basegfx;
using namespace basebmp;
@@ -152,35 +151,66 @@ void SvpSalGraphics::ResetClipRegion()
bool SvpSalGraphics::setClipRegion( const Region& i_rClip )
{
if( i_rClip.IsEmpty() )
+ {
m_aClipMap.reset();
- else if( i_rClip.GetRectCount() == 1 )
+ return true;
+ }
+
+ RectangleVector aRectangles;
+ i_rClip.GetRegionRectangles(aRectangles);
+
+ if(1 == aRectangles.size())
{
m_aClipMap.reset();
- Rectangle aBoundRect( i_rClip.GetBoundRect() );
- m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice,
- basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) );
+ const Rectangle& aBoundRect = aRectangles[0];
+ m_aDevice = basebmp::subsetBitmapDevice(
+ m_aOrigDevice,
+ basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) );
+ return true;
}
- else
+
+ m_aDevice = m_aOrigDevice;
+ B2IVector aSize = m_aDevice->getSize();
+ m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY );
+ m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) );
+
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
{
- m_aDevice = m_aOrigDevice;
- B2IVector aSize = m_aDevice->getSize();
- m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY );
- m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) );
+ const long nW(aRectIter->GetWidth());
- ImplRegionInfo aInfo;
- long nX, nY, nW, nH;
- bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
- while( bRegionRect )
+ if(nW)
{
- if ( nW && nH )
+ const long nH(aRectIter->GetHeight());
+
+ if(nH)
{
B2DPolyPolygon aFull;
- aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) );
- m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT );
+
+ aFull.append(
+ tools::createPolygonFromRect(
+ B2DRectangle(
+ aRectIter->Left(),
+ aRectIter->Top(),
+ aRectIter->Left() + nW,
+ aRectIter->Top() + nH)));
+ m_aClipMap->fillPolyPolygon(aFull, basebmp::Color(0), DrawMode_PAINT);
}
- 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 )
+ // {
+ // B2DPolyPolygon aFull;
+ // aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) );
+ // m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT );
+ // }
+ // bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
+ //}
return true;
}
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 281f8c57b53a..bcf938909538 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -51,7 +51,6 @@
#include "printergfx.hxx"
#include "svppspgraphics.hxx"
#include "svpbmp.hxx"
-#include "region.h"
using namespace psp;
using namespace rtl;
@@ -220,19 +219,41 @@ 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 );
}
+
+ //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;
}