[Libreoffice-commits] core.git: Branch 'aoo/trunk' - svgio/source
Armin Le Grand
alg at apache.org
Mon Jul 15 09:08:21 PDT 2013
svgio/source/svgreader/svgstyleattributes.cxx | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 1898f94578f266de42f92602a36518fb12bacf5a
Author: Armin Le Grand <alg at apache.org>
Date: Mon Jul 15 14:22:12 2013 +0000
i122724 Better handling of line-only paths
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 45214cb..795b8bc 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -997,12 +997,9 @@ namespace svgio
const basegfx::B2DPolyPolygon& rPath,
drawinglayer::primitive2d::Primitive2DSequence& rTarget) const
{
- const bool bIsLine(1 == rPath.count()
- && !rPath.areControlPointsUsed()
- && 2 == rPath.getB2DPolygon(0).count());
-
if(!rPath.count())
{
+ // no geometry at all
return;
}
@@ -1010,13 +1007,7 @@ namespace svgio
if(aGeoRange.isEmpty())
{
- return;
- }
-
- if(!bIsLine && // not for lines
- (basegfx::fTools::equalZero(aGeoRange.getWidth())
- || basegfx::fTools::equalZero(aGeoRange.getHeight())))
- {
+ // no geometry range
return;
}
@@ -1024,11 +1015,21 @@ namespace svgio
if(basegfx::fTools::equalZero(fOpacity))
{
+ // not visible
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)
{
+ // create fill
basegfx::B2DPolyPolygon aPath(rPath);
const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType());
const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && FillRule_nonzero == maClipRule);
@@ -1043,6 +1044,7 @@ namespace svgio
add_fill(aPath, rTarget, aGeoRange);
}
+ // create stroke
add_stroke(rPath, rTarget, aGeoRange);
// Svg supports markers for path, polygon, polyline and line
More information about the Libreoffice-commits
mailing list