diff options
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/primitive2d/polygonprimitive2d.cxx | 6 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 42 |
2 files changed, 31 insertions, 17 deletions
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index e296f397e01b..2350f28699fc 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -291,6 +291,9 @@ namespace drawinglayer maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) { + // simplify curve segments: moved here to not need to use it + // at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect + maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon); } PolygonStrokePrimitive2D::PolygonStrokePrimitive2D( @@ -301,6 +304,9 @@ namespace drawinglayer maLineAttribute(rLineAttribute), maStrokeAttribute() { + // simplify curve segments: moved here to not need to use it + // at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect + maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon); } bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 0845c3316643..3295a97129f3 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -127,9 +127,9 @@ namespace drawinglayer bool VclPixelProcessor2D::tryDrawPolygonHairlinePrimitive2DDirect(const drawinglayer::primitive2d::PolygonHairlinePrimitive2D& rSource, double fTransparency) { - basegfx::B2DPolygon aLocalPolygon(rSource.getB2DPolygon()); + const basegfx::B2DPolygon& rLocalPolygon(rSource.getB2DPolygon()); - if(!aLocalPolygon.count()) + if(!rLocalPolygon.count()) { // no geometry, done return true; @@ -139,10 +139,14 @@ namespace drawinglayer mpOutputDevice->SetFillColor(); mpOutputDevice->SetLineColor(Color(aLineColor)); - aLocalPolygon.transform(maCurrentTransformation); + //aLocalPolygon.transform(maCurrentTransformation); // try drawing; if it did not work, use standard fallback - return mpOutputDevice->DrawPolyLineDirect( aLocalPolygon, 0.0, fTransparency); + return mpOutputDevice->DrawPolyLineDirect( + maCurrentTransformation, + rLocalPolygon, + 0.0, + fTransparency); } bool VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect(const drawinglayer::primitive2d::PolygonStrokePrimitive2D& rSource, double fTransparency) @@ -158,7 +162,8 @@ namespace drawinglayer basegfx::B2DPolyPolygon aHairLinePolyPolygon; // simplify curve segments - aLocalPolygon = basegfx::utils::simplifyCurveSegments(aLocalPolygon); + // moved to PolygonStrokePrimitive2D::PolygonStrokePrimitive2D + // aLocalPolygon = basegfx::utils::simplifyCurveSegments(aLocalPolygon); if(rSource.getStrokeAttribute().isDefault() || 0.0 == rSource.getStrokeAttribute().getFullDotDashLen()) { @@ -182,24 +187,24 @@ namespace drawinglayer return true; } + // check if LineWidth can be simplified in world coordinates double fLineWidth(rSource.getLineAttribute().getWidth()); if(basegfx::fTools::more(fLineWidth, 0.0)) { basegfx::B2DVector aLineWidth(fLineWidth, 0.0); - aLineWidth = maCurrentTransformation * aLineWidth; - fLineWidth = aLineWidth.getLength(); - } + const double fWorldLineWidth(aLineWidth.getLength()); - // draw simple hairline for small line widths - // see also RenderPolygonStrokePrimitive2D which is used if this try fails - bool bIsAntiAliasing = getOptionsDrawinglayer().IsAntiAliasing(); - if ( (basegfx::fTools::lessOrEqual(fLineWidth, 1.0) && bIsAntiAliasing) - || (basegfx::fTools::lessOrEqual(fLineWidth, 1.5) && !bIsAntiAliasing)) - { - // draw simple hairline - fLineWidth = 0.0; + // draw simple hairline for small line widths + // see also RenderPolygonStrokePrimitive2D which is used if this try fails + bool bIsAntiAliasing = getOptionsDrawinglayer().IsAntiAliasing(); + if ( (basegfx::fTools::lessOrEqual(fWorldLineWidth, 1.0) && bIsAntiAliasing) + || (basegfx::fTools::lessOrEqual(fWorldLineWidth, 1.5) && !bIsAntiAliasing)) + { + // draw simple hairline + fLineWidth = 0.0; + } } const basegfx::BColor aLineColor( @@ -208,7 +213,9 @@ namespace drawinglayer mpOutputDevice->SetFillColor(); mpOutputDevice->SetLineColor(Color(aLineColor)); - aHairLinePolyPolygon.transform(maCurrentTransformation); + + // do not transform self + // aHairLinePolyPolygon.transform(maCurrentTransformation); bool bHasPoints(false); bool bTryWorked(false); @@ -222,6 +229,7 @@ namespace drawinglayer bHasPoints = true; if(mpOutputDevice->DrawPolyLineDirect( + maCurrentTransformation, aSingle, fLineWidth, fTransparency, |