summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2008-05-30 09:06:09 +0000
committerOliver Bolte <obo@openoffice.org>2008-05-30 09:06:09 +0000
commit844f9a38ab061c9ccebd0a73d0814a68f75d0b01 (patch)
tree6bbdba666cff6678754f8ea59c5e36efd31990a1
parentcec34297b62c1a2f10f9e728a1b6f9e2da26f3d5 (diff)
INTEGRATION: CWS aquabmpfix01 (1.54.38); FILE MERGED
2008/05/09 11:08:10 hdu 1.54.38.5: RESYNC: (1.54-1.55); FILE MERGED 2008/05/09 10:29:44 hdu 1.54.38.4: #i88759# use b2d polygon drawing if possible 2008/05/05 12:58:28 hdu 1.54.38.3: #i88795# extend Region class with B2D too 2008/05/05 10:41:02 hdu 1.54.38.2: #i88795# OutputDevice::ImplSelectClipRegion() coordinates are already transformed 2008/05/05 09:06:18 hdu 1.54.38.1: #i88795# use SalGraphics::UnionClipRegion(B2D) if available
-rw-r--r--vcl/source/gdi/outdev.cxx116
1 files changed, 99 insertions, 17 deletions
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 1a324e8c5eb8..279df8d49a48 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: outdev.cxx,v $
- * $Revision: 1.55 $
+ * $Revision: 1.56 $
*
* This file is part of OpenOffice.org.
*
@@ -65,7 +65,10 @@
#include <vcl/outdev.hxx>
#include <vcl/unowrap.hxx>
-// #i75163#
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <com/sun/star/awt/XGraphics.hpp>
@@ -175,6 +178,16 @@ BOOL OutputDevice::ImplSelectClipRegion( SalGraphics* pGraphics, const Region& r
// calling it with pOutDev=this!
DBG_TESTSOLARMUTEX();
+ if( rRegion.HasPolyPolygon()
+ && pGraphics->supportsOperation( OutDevSupport_B2DClip ) )
+ {
+ const ::basegfx::B2DPolyPolygon& rB2DPolyPolygon = rRegion.GetB2DPolyPolygon();
+ pGraphics->BeginSetClipRegion( 0 );
+ pGraphics->UnionClipRegion( rB2DPolyPolygon, pOutDev );
+ pGraphics->EndSetClipRegion();
+ return true;
+ }
+
long nX;
long nY;
long nWidth;
@@ -521,7 +534,11 @@ OutputDevice::~OutputDevice()
bool OutputDevice::supportsOperation( OutDevSupportType eType ) const
{
- return ImplGetGraphics() && mpGraphics->supportsOperation( eType );
+ if( !mpGraphics )
+ if( !ImplGetGraphics() )
+ return false;
+ const bool bHasSupport = mpGraphics->supportsOperation( eType );
+ return bHasSupport;
}
// -----------------------------------------------------------------------
@@ -1419,6 +1436,51 @@ void OutputDevice::ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon )
if(!(ImplGetGraphics()))
return;
+ if( mpGraphics->supportsOperation( OutDevSupport_B2DClip ) )
+ {
+ ::basegfx::B2DPolyPolygon aB2DPolyPolygon = rPolyPolygon.getB2DPolyPolygon();
+ const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation();
+ aB2DPolyPolygon.transform( aTransform );
+
+ // the rPolyPolygon argument is a "triangle thingy"
+ // so convert it to a normal polypolyon first
+ ::basegfx::B2DPolyPolygon aPolyTriangle;
+ const int nPolyCount = aB2DPolyPolygon.count();
+ for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+ {
+ const ::basegfx::B2DPolygon rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
+ const int nPointCount = rPolygon.count();
+ for( int nPointIdx = 0; nPointIdx+2 < nPointCount; nPointIdx +=3 )
+ {
+ ::basegfx::B2DPolygon aTriangle;
+ aTriangle.append( rPolygon.getB2DPoint( nPointIdx+0 ) );
+ aTriangle.append( rPolygon.getB2DPoint( nPointIdx+1 ) );
+ aTriangle.append( rPolygon.getB2DPoint( nPointIdx+2 ) );
+ aPolyTriangle.append( aTriangle );
+ }
+ }
+
+ // now set the clip region with the real polypolygon
+ mpGraphics->BeginSetClipRegion( 0 );
+ mpGraphics->UnionClipRegion( aPolyTriangle, this );
+ mpGraphics->EndSetClipRegion();
+
+ // and mark the clip status as ready
+ mbOutputClipped = FALSE;
+ mbClipRegion = TRUE;
+ mbClipRegionSet = TRUE;
+ mbInitClipRegion = FALSE;
+ return;
+ }
+
+ sal_Int32 offset_x = 0;
+ sal_Int32 offset_y = 0;
+ if ( GetOutDevType() == OUTDEV_WINDOW )
+ {
+ offset_x = mnOutOffX+mnOutOffOrigX;
+ offset_y = mnOutOffY+mnOutOffOrigY;
+ }
+
// first of all we need to know the upper limit
// of the amount of possible clipping regions.
sal_Int32 maxy = SAL_MIN_INT32;
@@ -1629,14 +1691,6 @@ void OutputDevice::ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon )
// the amount of regions.
container.Consolidate();
- sal_Int32 offset_x = 0;
- sal_Int32 offset_y = 0;
- if ( GetOutDevType() == OUTDEV_WINDOW )
- {
- offset_x = mnOutOffX+mnOutOffOrigX;
- offset_y = mnOutOffY+mnOutOffOrigY;
- }
-
// now forward the spantable to the graphics handler.
SpanIterator it(container.Iterate());
mpGraphics->BeginSetClipRegion( container.GetNumSpans() );
@@ -2314,10 +2368,8 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
// we need a graphics
if ( !mpGraphics )
- {
if ( !ImplGetGraphics() )
return;
- }
if ( mbInitClipRegion )
ImplInitClipRegion();
@@ -2327,6 +2379,18 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
if ( mbInitLineColor )
ImplInitLineColor();
+ // use b2dpolygon drawing if possible
+ if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
+ {
+ ::basegfx::B2DPolygon aB2DPolyLine = rPoly.getB2DPolygon();
+ const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation();
+ aB2DPolyLine.transform( aTransform );
+ const ::basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
+ if( mpGraphics->DrawPolyLine( aB2DPolyLine, aB2DLineWidth, this ) )
+ return;
+ }
+
Polygon aPoly = ImplLogicToDevicePixel( rPoly );
const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
@@ -2449,10 +2513,8 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly )
// we need a graphics
if ( !mpGraphics )
- {
if ( !ImplGetGraphics() )
return;
- }
if ( mbInitClipRegion )
ImplInitClipRegion();
@@ -2464,6 +2526,17 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly )
if ( mbInitFillColor )
ImplInitFillColor();
+ // use b2dpolygon drawing if possible
+ if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
+ {
+ ::basegfx::B2DPolyPolygon aB2DPolyPolygon( rPoly.getB2DPolygon() );
+ const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation();
+ aB2DPolyPolygon.transform( aTransform );
+ if( mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, 0.0, this ) )
+ return;
+ }
+
Polygon aPoly = ImplLogicToDevicePixel( rPoly );
const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
@@ -2504,10 +2577,8 @@ void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
// we need a graphics
if ( !mpGraphics )
- {
if ( !ImplGetGraphics() )
return;
- }
if ( mbInitClipRegion )
ImplInitClipRegion();
@@ -2519,6 +2590,17 @@ void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
if ( mbInitFillColor )
ImplInitFillColor();
+ // use b2dpolygon drawing if possible
+ if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
+ {
+ ::basegfx::B2DPolyPolygon aB2DPolyPolygon = rPolyPoly.getB2DPolyPolygon();
+ const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation();
+ aB2DPolyPolygon.transform( aTransform );
+ if( mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, 0.0, this ) )
+ return;
+ }
+
if ( nPoly == 1 )
{
// #100127# Map to DrawPolygon