summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-07-30 10:40:37 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-07-30 10:40:37 +0000
commita439835cc8ed03f3c834f5688a2c5b5da87a3225 (patch)
treee779b32f99f0db51b42bdf20abc2c77bc040021c /vcl/source
parent3bf6f1976814b5488c4572954dbadf624a4130cf (diff)
CWS-TOOLING: integrate CWS aw074_DEV300
2009-07-06 13:21:50 +0200 aw r273737 : CWS-TOOLING: rebase CWS aw074 to branches/OOO310@273700 (milestone: OOO310:m15) 2009-07-06 11:12:35 +0200 aw r273728 : #i102637# corrected condition to add gray frame to page visualisation objects 2009-07-03 14:43:00 +0200 aw r273702 : #i102380# always swap n GrafObjects on MasterPages synchronously 2009-07-03 12:14:57 +0200 aw r273686 : #i102548# corrected SdrPathPrimitive2D's usage of unit polygon 2009-07-02 16:06:16 +0200 aw r273662 : #i103255# added control when to show the draft graphic visualisation (in VOC, of course) and when not. Changed text visualisation to BlockText 2009-07-01 17:36:55 +0200 aw r273609 : #i103116# clear GaphicLink for interaction clone of graphic objets 2009-07-01 16:42:09 +0200 aw r273601 : #i101491# corrected some minor glitches in line geometry creation 2009-06-30 18:47:44 +0200 aw r273532 : #i102380# committed the cleanups/additions for the fix 2009-06-26 13:16:17 +0200 aw r273404 : #i101491# finetuning changes 2009-06-26 13:15:57 +0200 aw r273403 : #i101491# finetuning changes 2009-06-25 16:31:26 +0200 aw r273387 : #i101491# first version checkin for linux/mac tests 2009-06-25 16:31:04 +0200 aw r273386 : #i101491# first version checkin for linux/mac tests 2009-06-24 15:35:05 +0200 aw r273350 : #i101734# corrected VclMetafileProcessor2D::impTryToCreateSvtGraphicStroke to use the current ObjectTransformation 2009-06-24 15:01:58 +0200 aw r273348 : #i101811# added ViewInformation2D to renderChartPrimitive2D to allow embedding of object transformation to target MapMode 2009-06-24 12:27:05 +0200 aw r273328 : #i101980# use a hairline LineWitdth for SdrObject::TakeContour() calculation (like the old implementation did) 2009-06-24 11:29:43 +0200 aw r273321 : #i101781# corrected creation fallback for FullDrag for circle objects 2009-06-23 17:26:58 +0200 aw r273300 : #i101556# made primitive text attributes take versioned base text attribute sets into account
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/outdev.cxx155
1 files changed, 128 insertions, 27 deletions
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index ebcf31199364..5b543258cb0b 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -69,6 +69,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
#include <com/sun/star/awt/XGraphics.hpp>
#include <com/sun/star/uno/Sequence.hxx>
@@ -2472,11 +2473,13 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
if ( mbInitLineColor )
ImplInitLineColor();
- // use b2dpolygon drawing if possible
- if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
&& ROP_OVERPAINT == GetRasterOp()
- && IsLineColor())
+ && IsLineColor());
+
+ // use b2dpolygon drawing if possible
+ if(bTryAA && ImpTryDrawPolyLineDirect(rPoly.getB2DPolygon(), 0.0, basegfx::B2DLINEJOIN_NONE))
{
basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon());
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
@@ -2533,9 +2536,23 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
return;
}
+ // #i101491#
+ // Try direct Fallback to B2D-Version of DrawPolyLine
+ if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ && LINE_SOLID == rLineInfo.GetStyle())
+ {
+ DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), basegfx::B2DLINEJOIN_ROUND);
+ return;
+ }
+
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaPolyLineAction( rPoly, rLineInfo ) );
+ ImpDrawPolyLineWithLineInfo(rPoly, rLineInfo);
+}
+
+void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo)
+{
USHORT nPoints = rPoly.GetSize();
if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LINE_NONE == rLineInfo.GetStyle() ) || ImplIsRecordLayout() )
@@ -2561,6 +2578,10 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
return;
const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+ const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ && mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
+ && ROP_OVERPAINT == GetRasterOp()
+ && IsLineColor());
if( aInfo.GetWidth() > 1L )
{
@@ -2574,9 +2595,32 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo
ImplInitLineColor();
SetFillColor( aOldLineColor );
ImplInitFillColor();
+ bool bDone(false);
- for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
- mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this );
+ if(bTryAA)
+ {
+ // #i101491# try AAed version
+ // Use old on-the-fly geometry preparation, combine with AA
+ bool bSuccess(true);
+
+ for(const Polygon* pPoly = aLineCvt.ImplGetFirst(); bSuccess && pPoly; pPoly = aLineCvt.ImplGetNext())
+ {
+ bSuccess = mpGraphics->DrawPolyPolygon(basegfx::B2DPolyPolygon(pPoly->getB2DPolygon()), 0.0, this);
+ }
+
+ if(bSuccess)
+ {
+ bDone = true;
+ }
+ }
+
+ if(!bDone)
+ {
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ {
+ mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this );
+ }
+ }
SetLineColor( aOldLineColor );
SetFillColor( aOldFillColor );
@@ -2820,6 +2864,12 @@ void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly
mpMetaFile->AddAction( new MetaPolyPolygonAction( PolyPolygon( rB2DPolyPoly ) ) );
#endif
+ // call helper
+ ImpDrawPolyPolygonWithB2DPolyPolygon(rB2DPolyPoly);
+}
+
+void OutputDevice::ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly)
+{
// AW: Do NOT paint empty PolyPolygons
if(!rB2DPolyPoly.count())
return;
@@ -2886,6 +2936,38 @@ void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly
// -----------------------------------------------------------------------
+bool OutputDevice::ImpTryDrawPolyLineDirect(
+ const basegfx::B2DPolygon& rB2DPolygon,
+ double fLineWidth,
+ basegfx::B2DLineJoin eLineJoin)
+{
+ const basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
+ basegfx::B2DVector aB2DLineWidth(1.0, 1.0);
+
+ // transform the line width if used
+ if( fLineWidth != 0.0 )
+ {
+ aB2DLineWidth = aTransform * ::basegfx::B2DVector( fLineWidth, fLineWidth );
+ }
+
+ // transform the polygon
+ basegfx::B2DPolygon aB2DPolygon(rB2DPolygon);
+ aB2DPolygon.transform(aTransform);
+
+ if((mnAntialiasing & ANTIALIASING_PIXELSNAPHAIRLINE)
+ && aB2DPolygon.count() < 1000)
+ {
+ // #i98289#, #i101491#
+ // better to remove doubles on device coordinates. Also assume from a given amount
+ // of points that the single edges are not long enough to smooth
+ aB2DPolygon.removeDoublePoints();
+ aB2DPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolygon);
+ }
+
+ // draw the polyline
+ return mpGraphics->DrawPolyLine(aB2DPolygon, aB2DLineWidth, eLineJoin, this);
+}
+
void OutputDevice::DrawPolyLine(
const basegfx::B2DPolygon& rB2DPolygon,
double fLineWidth,
@@ -2929,43 +3011,62 @@ void OutputDevice::DrawPolyLine(
if( mbInitLineColor )
ImplInitLineColor();
- // #i98289# use b2dpolygon drawing if possible
- if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
+ const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
&& ROP_OVERPAINT == GetRasterOp()
- && IsLineColor())
+ && IsLineColor());
+
+ // use b2dpolygon drawing if possible
+ if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, eLineJoin))
{
- const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation());
- basegfx::B2DPolygon aB2DPolygon(rB2DPolygon);
- basegfx::B2DVector aB2DLineWidth(1.0, 1.0);
+ return;
+ }
- // transform the polygon
- aB2DPolygon.transform(aTransform);
+ // #i101491#
+ // no output yet; fallback to geometry decomposition and use filled polygon paint
+ // when line is fat and not too complex. ImpDrawPolyPolygonWithB2DPolyPolygon
+ // will do internal needed AA checks etc.
+ if(fLineWidth >= 2.5
+ && rB2DPolygon.count()
+ && rB2DPolygon.count() <= 1000)
+ {
+ const double fHalfLineWidth((fLineWidth * 0.5) + 0.5);
+ const basegfx::B2DPolyPolygon aAreaPolyPolygon(basegfx::tools::createAreaGeometry(
+ rB2DPolygon, fHalfLineWidth, eLineJoin));
- // transform the line width if used
- if(fLineWidth != 0.0)
- {
- aB2DLineWidth = aTransform * ::basegfx::B2DVector(fLineWidth, fLineWidth);
- }
+ const Color aOldLineColor(maLineColor);
+ const Color aOldFillColor(maFillColor);
- if(mnAntialiasing & ANTIALIASING_PIXELSNAPHAIRLINE)
- {
- aB2DPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolygon);
- }
+ SetLineColor();
+ ImplInitLineColor();
+ SetFillColor(aOldLineColor);
+ ImplInitFillColor();
+
+ ImpDrawPolyPolygonWithB2DPolyPolygon(aAreaPolyPolygon);
+
+ SetLineColor(aOldLineColor);
+ ImplInitLineColor();
+ SetFillColor(aOldFillColor);
+ ImplInitFillColor();
- // draw the polyline
- if(mpGraphics->DrawPolyLine(aB2DPolygon, aB2DLineWidth, eLineJoin, this))
+ if(bTryAA)
{
- return;
+ // when AA it is necessary to also paint the filled polygon's outline
+ // to avoid optical gaps
+ for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
+ {
+ ImpTryDrawPolyLineDirect(aAreaPolyPolygon.getB2DPolygon(a), 0.0, basegfx::B2DLINEJOIN_NONE);
+ }
}
}
- // fallback to old polygon drawing if needed
+ // fallback to old polygon drawing if needed. This will really
+ // use ImplLineConverter, but still try to AA lines
const Polygon aToolsPolygon( rB2DPolygon );
LineInfo aLineInfo;
if( fLineWidth != 0.0 )
aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
- DrawPolyLine( aToolsPolygon, aLineInfo );
+ ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo );
}
// -----------------------------------------------------------------------