Kaydet (Commit) 591903a1 authored tarafından Chr. Rossmanith's avatar Chr. Rossmanith Kaydeden (comit) Thorsten Behrens

tdf#51165: handle mixture of open and closed polygons in a path

Change-Id: I66c7fb2b627d3380c09b6e5e495905bed67c2824
Reviewed-on: https://gerrit.libreoffice.org/19860Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst f019f5d6
......@@ -128,6 +128,35 @@ double colorDiffSquared(const ARGBColor& rCol1, const ARGBColor& rCol2)
+ square(rCol1.b-rCol2.b);
}
/**
check whether a polypolygon contains both open and closed
polygons
**/
bool PolyPolygonIsMixedOpenAndClosed( const basegfx::B2DPolyPolygon& rPoly )
{
bool bRetval(false);
bool bOpen(false);
bool bClosed(false);
// PolyPolygon is mixed open and closed if there is more than one
// polygon and there are both closed and open polygons.
for( sal_uInt32 a(0L); !bRetval && a < rPoly.count(); a++ )
{
if ( (rPoly.getB2DPolygon(a)).isClosed() )
{
bClosed = true;
}
else
{
bOpen = true;
}
bRetval = (bClosed && bOpen);
}
return bRetval;
}
typedef std::map<OUString,sal_Size> ElementRefMapType;
struct AnnotatingVisitor
......@@ -1366,11 +1395,26 @@ struct ShapeWritingVisitor
aPoly.setClosed(true);
}
writePathShape(xAttrs,
xUnoAttrs,
xElem,
sStyleId,
aPoly);
// tdf#51165: rendering of paths with open and closed polygons is not implemented
// split mixed polypolygons into single polygons and add them one by one
if( PolyPolygonIsMixedOpenAndClosed(aPoly) )
{
for( sal_uInt32 i(0L); i<aPoly.count(); ++i ) {
writePathShape(xAttrs,
xUnoAttrs,
xElem,
sStyleId,
basegfx::B2DPolyPolygon(aPoly.getB2DPolygon(i)));
}
}
else
{
writePathShape(xAttrs,
xUnoAttrs,
xElem,
sStyleId,
aPoly);
}
break;
}
case XML_CIRCLE:
......
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