summaryrefslogtreecommitdiff
path: root/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx')
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx53
1 files changed, 41 insertions, 12 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 6f690ca55f46..0dc0904015f0 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1574,31 +1574,60 @@ void VclMetafileProcessor2D::processPolygonStrokePrimitive2D(
if (basegfx::fTools::more(rLine.getWidth(), 0.0))
{
const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute();
- basegfx::B2DPolyPolygon aHairLinePolyPolygon;
+ const basegfx::BColor aHairlineColor(
+ maBColorModifierStack.getModifiedColor(rLine.getColor()));
+ mpOutputDevice->SetLineColor(Color(aHairlineColor));
+ mpOutputDevice->SetFillColor();
+
+ // use the transformed line width
+ LineInfo aLineInfo(LineStyle::Solid,
+ basegfx::fround(getTransformedLineWidth(rLine.getWidth())));
+ aLineInfo.SetLineJoin(rLine.getLineJoin());
+ aLineInfo.SetLineCap(rLine.getLineCap());
+
+ basegfx::B2DPolyPolygon aHairLinePolyPolygon;
if (0.0 == rStroke.getFullDotDashLen())
{
aHairLinePolyPolygon.append(rBasePolygon);
}
+ else if (rStroke.getDotDashArray().size() == 2)
+ {
+ aHairLinePolyPolygon.append(rBasePolygon);
+ // This will be used by setupStrokeAttributes() in cppcanvas.
+ aLineInfo.SetStyle(LineStyle::Dash);
+ aLineInfo.SetDashCount(1);
+ aLineInfo.SetDashLen(
+ basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[0])));
+ aLineInfo.SetDistance(
+ basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[1])));
+ }
+ else if (rStroke.getDotDashArray().size() == 4
+ && rStroke.getDotDashArray()[1] == rStroke.getDotDashArray()[3])
+ {
+ aHairLinePolyPolygon.append(rBasePolygon);
+ // This will be used by setupStrokeAttributes() in cppcanvas.
+ aLineInfo.SetStyle(LineStyle::Dash);
+ aLineInfo.SetDashCount(1);
+ aLineInfo.SetDashLen(
+ basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[0])));
+ aLineInfo.SetDistance(
+ basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[1])));
+ aLineInfo.SetDotCount(1);
+ aLineInfo.SetDotLen(
+ basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[2])));
+ }
else
{
+ // LineInfo can hold only limited info about dashing, apply dashing manually
+ // if LineInfo cannot describe it. That should not happen though.
+ SAL_WARN("drawinglayer", "dotdash array cannot be converted to LineInfo");
basegfx::utils::applyLineDashing(rBasePolygon, rStroke.getDotDashArray(),
&aHairLinePolyPolygon, nullptr,
rStroke.getFullDotDashLen());
}
-
- const basegfx::BColor aHairlineColor(
- maBColorModifierStack.getModifiedColor(rLine.getColor()));
- mpOutputDevice->SetLineColor(Color(aHairlineColor));
- mpOutputDevice->SetFillColor();
aHairLinePolyPolygon.transform(maCurrentTransformation);
- // use the transformed line width
- LineInfo aLineInfo(LineStyle::Solid,
- basegfx::fround(getTransformedLineWidth(rLine.getWidth())));
- aLineInfo.SetLineJoin(rLine.getLineJoin());
- aLineInfo.SetLineCap(rLine.getLineCap());
-
for (sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
{
const basegfx::B2DPolygon& aCandidate(aHairLinePolyPolygon.getB2DPolygon(a));