summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2008-07-30 12:14:23 +0000
committerRüdiger Timm <rt@openoffice.org>2008-07-30 12:14:23 +0000
commit9b2fc28fc430106ecea3edc8ea75632d2c87315d (patch)
tree3f69324aac4eb756bc087aea1bb0ead69449a44a /vcl
parent1d9ad7f185ceb02e6e4f839f7ce7827a4ff76120 (diff)
INTEGRATION: CWS vcl91 (1.28.82); FILE MERGED
2008/07/21 12:19:13 hdu 1.28.82.7: #i90639# fully support SAL_DISABLE_NATIVE_ALPHA debugging in OutputDevice::DrawTransparent() 2008/07/18 11:25:40 hdu 1.28.82.6: OutputDevice::DrawTransparentColor(): another round of minor cleanups 2008/07/18 10:34:44 hdu 1.28.82.5: OutputDevice::DrawTransparentColor(): get rid of stupid compiler warnings 2008/07/18 10:29:17 hdu 1.28.82.4: OutputDevice::DrawTransparentColor(): remove some redundancies 2008/07/18 10:05:18 hdu 1.28.82.3: OutputDevice::DrawTransparentColor(): short circuit for painting opaque or invisible polygons 2008/07/18 09:58:00 hdu 1.28.82.2: OutputDevice::DrawTransparentColor() seems to assume that the border should NOT be drawn as transparent??? 2008/07/17 18:42:33 hdu 1.28.82.1: OutputDevice::DrawTransparentColor(): prevent use of the slow and complex emulation layers if possible
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/outdev6.cxx92
1 files changed, 78 insertions, 14 deletions
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 23efe1d05f4c..13ece80258ec 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: outdev6.cxx,v $
- * $Revision: 1.28 $
+ * $Revision: 1.29 $
*
* This file is part of OpenOffice.org.
*
@@ -49,6 +49,10 @@
#include <vcl/wall2.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
#include <vcl/window.h>
#include <vcl/svdata.hxx>
@@ -160,26 +164,89 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
DBG_TRACE( "OutputDevice::DrawTransparent()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
- if( !mbFillColor || ( 0 == nTransparencePercent ) || ( mnDrawMode & ( DRAWMODE_NOTRANSPARENCY ) ) )
+ // short circuit for drawing an opaque polygon
+ if( (nTransparencePercent < 1) || ((mnDrawMode & DRAWMODE_NOTRANSPARENCY) != 0) )
+ {
DrawPolyPolygon( rPolyPoly );
- else if( 100 == nTransparencePercent )
+ return;
+ }
+
+ // short circut for drawing an invisible polygon
+ if( !mbFillColor || (nTransparencePercent >= 100) )
{
+ // short circuit if the polygon border is invisible too
+ if( !mbLineColor )
+ return;
+
+ // DrawTransparent() assumes that the border is NOT to be drawn transparently???
Push( PUSH_FILLCOLOR );
SetFillColor();
DrawPolyPolygon( rPolyPoly );
Pop();
+ return;
}
- else
- {
- if( mpMetaFile )
- mpMetaFile->AddAction( new MetaTransparentAction( rPolyPoly, nTransparencePercent ) );
- if( !IsDeviceOutputNecessary() || ( !mbLineColor && !mbFillColor ) || ImplIsRecordLayout() )
+ // handle metafile recording
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTransparentAction( rPolyPoly, nTransparencePercent ) );
+
+ bool bDrawn = !IsDeviceOutputNecessary() || ImplIsRecordLayout();
+ if( bDrawn )
+ return;
+
+ // get the device graphics as drawing target
+ if( !mpGraphics )
+ if( !ImplGetGraphics() )
return;
- if( !mpGraphics && !ImplGetGraphics() )
+ // debug helper:
+ static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
+
+ // try hard to draw it directly, because the emulation layers are @!#!
+ if( !pDisableNative
+ && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) )
+ {
+ // prepare the graphics device
+ if( mbInitClipRegion )
+ ImplInitClipRegion();
+ if( mbOutputClipped )
return;
+ if( mbInitLineColor )
+ ImplInitLineColor();
+ if( mbInitFillColor )
+ ImplInitFillColor();
+
+ // get the polygon in device coordinates
+ ::basegfx::B2DPolyPolygon aB2DPolyPolygon = rPolyPoly.getB2DPolyPolygon();
+ const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
+ aB2DPolyPolygon.transform( aTransform );
+
+ // draw the transparent polygon
+ bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, nTransparencePercent*0.01, this );
+
+ // DrawTransparent() assumes that the border is NOT to be drawn transparently???
+ if( mbLineColor )
+ {
+ // disable the fill color for now
+ mpGraphics->SetFillColor();
+ // draw the border line
+ const basegfx::B2DVector aLineWidths( 1, 1 );
+ const int nPolyCount = aB2DPolyPolygon.count();
+ for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+ {
+ const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
+ mpGraphics->DrawPolyLine( rPolygon, aLineWidths, this );
+ }
+ // prepare to restore the fill color
+ mbInitFillColor = mbFillColor;
+ }
+ }
+ if( bDrawn )
+ return;
+
+ if( 1 )
+ {
VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
// #110958# Disable alpha VDev, we perform the necessary
@@ -237,7 +304,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
}
else
{
- PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
+ PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
Rectangle aPolyRect( aPolyPoly.GetBoundRect() );
Point aPoint;
Rectangle aDstRect( aPoint, GetOutputSizePixel() );
@@ -254,9 +321,6 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
if( !aDstRect.IsEmpty() )
{
- bool bDrawn = false;
- static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
-
// #i66849# Added fast path for exactly rectangular
// polygons
// #i83087# Naturally, system alpha blending cannot
@@ -265,7 +329,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
{
// setup Graphics only here (other cases delegate
// to basic OutDev methods)
- if( mpGraphics || ImplGetGraphics() )
+ if( 1 )
{
if ( mbInitClipRegion )
ImplInitClipRegion();