Kaydet (Commit) 07ec224a authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i122724# Better handling of line-only paths

(cherry picked from commit 1898f945)

Change-Id: I3033197e7c59a829c012b84c1d4cbaca7d155d2a
üst 52bce8fa
...@@ -988,12 +988,9 @@ namespace svgio ...@@ -988,12 +988,9 @@ namespace svgio
const basegfx::B2DPolyPolygon& rPath, const basegfx::B2DPolyPolygon& rPath,
drawinglayer::primitive2d::Primitive2DSequence& rTarget) const drawinglayer::primitive2d::Primitive2DSequence& rTarget) const
{ {
const bool bIsLine(1 == rPath.count()
&& !rPath.areControlPointsUsed()
&& 2 == rPath.getB2DPolygon(0).count());
if(!rPath.count()) if(!rPath.count())
{ {
// no geometry at all
return; return;
} }
...@@ -1001,13 +998,7 @@ namespace svgio ...@@ -1001,13 +998,7 @@ namespace svgio
if(aGeoRange.isEmpty()) if(aGeoRange.isEmpty())
{ {
return; // no geometry range
}
if(!bIsLine && // not for lines
(basegfx::fTools::equalZero(aGeoRange.getWidth())
|| basegfx::fTools::equalZero(aGeoRange.getHeight())))
{
return; return;
} }
...@@ -1015,11 +1006,21 @@ namespace svgio ...@@ -1015,11 +1006,21 @@ namespace svgio
if(basegfx::fTools::equalZero(fOpacity)) if(basegfx::fTools::equalZero(fOpacity))
{ {
// not visible
return; return;
} }
// check if it's a line
const bool bNoWidth(basegfx::fTools::equalZero(aGeoRange.getWidth()));
const bool bNoHeight(basegfx::fTools::equalZero(aGeoRange.getHeight()));
const bool bIsTwoPointLine(1 == rPath.count()
&& !rPath.areControlPointsUsed()
&& 2 == rPath.getB2DPolygon(0).count());
const bool bIsLine(bIsTwoPointLine || bNoWidth || bNoHeight);
if(!bIsLine) if(!bIsLine)
{ {
// create fill
basegfx::B2DPolyPolygon aPath(rPath); basegfx::B2DPolyPolygon aPath(rPath);
const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType()); const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType());
const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && FillRule_nonzero == maClipRule); const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && FillRule_nonzero == maClipRule);
...@@ -1034,6 +1035,7 @@ namespace svgio ...@@ -1034,6 +1035,7 @@ namespace svgio
add_fill(aPath, rTarget, aGeoRange); add_fill(aPath, rTarget, aGeoRange);
} }
// create stroke
add_stroke(rPath, rTarget, aGeoRange); add_stroke(rPath, rTarget, aGeoRange);
// Svg supports markers for path, polygon, polyline and line // Svg supports markers for path, polygon, polyline and line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment