diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-30 10:40:37 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-30 10:40:37 +0000 |
commit | 6f6d592033ba648c56b87c7f646ab394162201d7 (patch) | |
tree | 2e3e71c1ef6ccfa26d556d699b723dc0d8c436c7 /drawinglayer | |
parent | dd431e5d75389aa997300bb9f31afb408fec13b8 (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 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 63 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 244 |
2 files changed, 188 insertions, 119 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index cc51ebf6371e..24f54d3ddc58 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1010,7 +1010,68 @@ namespace drawinglayer adaptLineToFillDrawMode(); impStartSvtGraphicStroke(pSvtGraphicStroke); - process(rCandidate.get2DDecomposition(getViewInformation2D())); + + // #i101491# + // Change default of fat line generation for MetaFiles: Create MetaPolyLineAction + // instead of decomposing all geometries when the polygon has more than given amount of + // points; else the decomposition will get too expensive quiclky. OTOH + // the decomposition provides the better quality e.g. taking edge roundings + // into account which will NOT be taken into account with LineInfo-based actions + const sal_uInt32 nSubPolygonCount(rStrokePrimitive.getB2DPolygon().count()); + bool bDone(0 == nSubPolygonCount); + + if(!bDone && nSubPolygonCount > 1000) + { + // create MetaPolyLineActions, but without LINE_DASH + const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute(); + + if(basegfx::fTools::more(rLine.getWidth(), 0.0)) + { + const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute(); + basegfx::B2DPolyPolygon aHairLinePolyPolygon; + + if(0.0 == rStroke.getFullDotDashLen()) + { + aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon()); + } + else + { + basegfx::tools::applyLineDashing( + rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(), + &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen()); + } + + const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLine.getColor())); + mpOutputDevice->SetLineColor(Color(aHairlineColor)); + mpOutputDevice->SetFillColor(); + + aHairLinePolyPolygon.transform(maCurrentTransformation); + + const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth())); + + for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aHairLinePolyPolygon.getB2DPolygon(a)); + + if(aCandidate.count() > 1) + { + const Polygon aToolsPolygon(aCandidate); + + mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); + } + } + + bDone = true; + } + } + + if(!bDone) + { + // use decomposition (creates line geometry as filled polygon + // geometry) + process(rCandidate.get2DDecomposition(getViewInformation2D())); + } + impEndSvtGraphicStroke(pSvtGraphicStroke); // restore DrawMode diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 08dba659a6a0..0c5299c9c99d 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1011,6 +1011,8 @@ namespace drawinglayer void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate) { + // #i101491# method restructured to clearly use the DrawPolyLine + // calls starting from a deined line width const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute(); const double fLineWidth(rLineAttribute.getWidth()); bool bDone(false); @@ -1019,154 +1021,160 @@ namespace drawinglayer { const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0)); const double fDiscreteLineWidth(aDiscreteUnit.getLength()); - const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing()); - const double fAllowedUpperBound(bAntiAliased ? 3.0 : 2.5); + const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute(); + const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor())); + basegfx::B2DPolyPolygon aHairlinePolyPolygon; - if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, fAllowedUpperBound)) + mpOutputDevice->SetLineColor(Color(aHairlineColor)); + mpOutputDevice->SetFillColor(); + + if(0.0 == rStrokeAttribute.getFullDotDashLen()) + { + // no line dashing, just copy + aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon()); + } + else { - // force to hairline - const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute(); - const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor())); - basegfx::B2DPolyPolygon aHairlinePolyPolygon; + // else apply LineStyle + basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(), + rStrokeAttribute.getDotDashArray(), + &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen()); + } - mpOutputDevice->SetLineColor(Color(aHairlineColor)); - mpOutputDevice->SetFillColor(); + const sal_uInt32 nCount(aHairlinePolyPolygon.count()); - if(0.0 == rStrokeAttribute.getFullDotDashLen()) - { - // no line dashing, just copy - aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon()); - } - else - { - // else apply LineStyle - basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(), - rStrokeAttribute.getDotDashArray(), - &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen()); - } - - const sal_uInt32 nCount(aHairlinePolyPolygon.count()); + if(nCount) + { + const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing()); + aHairlinePolyPolygon.transform(maCurrentTransformation); - if(nCount) + for(sal_uInt32 a(0); a < nCount; a++) { - aHairlinePolyPolygon.transform(maCurrentTransformation); + basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); if(bAntiAliased) { - for(sal_uInt32 a(0); a < nCount; a++) + if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0)) { - basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); - - if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0)) - { - // line in range ]0.0 .. 1.0[ - // paint as simple hairline - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } - else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0)) - { - // line in range [1.0 .. 2.0[ - // paint as 2x2 with dynamic line distance - basegfx::B2DHomMatrix aMat; - const double fDistance(fDiscreteLineWidth - 1.0); - const double fHalfDistance(fDistance * 0.5); - - aMat.set(0, 2, -fHalfDistance); - aMat.set(1, 2, -fHalfDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, fDistance); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, 0.0); - aMat.set(1, 2, fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, -fDistance); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } - else - { - // line in range [2.0 .. 3.0] - // paint as cross in a 3x3 with dynamic line distance - basegfx::B2DHomMatrix aMat; - const double fDistance((fDiscreteLineWidth - 1.0) * 0.5); - - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, -fDistance); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, fDistance); - aMat.set(1, 2, -fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, fDistance); - aMat.set(1, 2, fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, -fDistance); - aMat.set(1, 2, fDistance); - aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } + // line in range ]0.0 .. 1.0[ + // paint as simple hairline + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0)) + { + // line in range [1.0 .. 2.0[ + // paint as 2x2 with dynamic line distance + basegfx::B2DHomMatrix aMat; + const double fDistance(fDiscreteLineWidth - 1.0); + const double fHalfDistance(fDistance * 0.5); + + aMat.set(0, 2, -fHalfDistance); + aMat.set(1, 2, -fHalfDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, fDistance); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, 0.0); + aMat.set(1, 2, fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, -fDistance); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0)) + { + // line in range [2.0 .. 3.0] + // paint as cross in a 3x3 with dynamic line distance + basegfx::B2DHomMatrix aMat; + const double fDistance((fDiscreteLineWidth - 1.0) * 0.5); + + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, -fDistance); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, fDistance); + aMat.set(1, 2, -fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, fDistance); + aMat.set(1, 2, fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + + aMat.set(0, 2, -fDistance); + aMat.set(1, 2, fDistance); + aCandidate.transform(aMat); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else + { + // #i101491# line width above 3.0 } } else { - if(basegfx::fTools::more(fDiscreteLineWidth, 1.5)) + if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5)) + { + // line width below 1.5, draw the basic hairline polygon + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; + } + else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5)) { // line width is in range ]1.5 .. 2.5], use four hairlines // drawn in a square basegfx::B2DHomMatrix aMat; + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - for(sal_uInt32 a(0); a < nCount; a++) - { - basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - - aMat.set(0, 2, 1.0); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); + aMat.set(0, 2, 1.0); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - aMat.set(0, 2, 0.0); - aMat.set(1, 2, 1.0); - aCandidate.transform(aMat); + aMat.set(0, 2, 0.0); + aMat.set(1, 2, 1.0); + aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - aMat.set(0, 2, -1.0); - aMat.set(1, 2, 0.0); - aCandidate.transform(aMat); + aMat.set(0, 2, -1.0); + aMat.set(1, 2, 0.0); + aCandidate.transform(aMat); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } + mpOutputDevice->DrawPolyLine(aCandidate, 0.0); + bDone = true; } else { - for(sal_uInt32 a(0); a < nCount; a++) - { - // draw the basic hairline polygon - const basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a)); - mpOutputDevice->DrawPolyLine(aCandidate, 0.0); - } + // #i101491# line width is above 2.5 } } - } - bDone = true; + if(!bDone && rPolygonStrokeCandidate.getB2DPolygon().count() > 1000) + { + // #i101491# If the polygon complexity uses more than a given amount, do + // use OuputDevice::DrawPolyLine directly; this will avoid buffering all + // decompositions in primtives (memory) and fallback to old line painting + // for very complex polygons, too + mpOutputDevice->DrawPolyLine(aCandidate, fDiscreteLineWidth, rLineAttribute.getLineJoin()); + bDone = true; + } + } } } |