summaryrefslogtreecommitdiff
path: root/basegfx/source/polygon
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-06-22 09:36:20 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-06-22 12:54:25 +0200
commitbfc8f933669f486931da4808211154ff6d6965c0 (patch)
treeba7ddd6000964e29b41dc60ecbe61ecc2fbfcfed /basegfx/source/polygon
parent39770935e4bb889fa987d51af91509932c2fac1d (diff)
Use the sweep flag to determine the drawing direction
The previous solution was giving somehow acceptable results in the majority of cases, but was pretty broken with corner cases where the arc is exactly half of the whole ellipse and where the large arc flag is largely irrelevant. If the sweep flag is equal to 0 drawing goes in the sense of decreasing angles. If it is set, drawing goes in the sense of increasing angles.
Diffstat (limited to 'basegfx/source/polygon')
-rw-r--r--basegfx/source/polygon/b2dsvgpolypolygon.cxx7
1 files changed, 2 insertions, 5 deletions
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 50a04dbaa075..074cfd9e25d5 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -787,10 +787,7 @@ namespace basegfx
// (since
// createPolygonFromEllipseSegment()
// normalizes to e.g. cw arc)
- const bool bLessThanPi(fmod(fTheta2+2*M_PI-fTheta1,
- 2*M_PI)<M_PI);
- const bool bFlipSegment( (bLargeArcFlag!=0) == bLessThanPi );
- if( bFlipSegment )
+ if( !bSweepFlag )
std::swap(fTheta1,fTheta2);
// finally, create bezier polygon from this
@@ -812,7 +809,7 @@ namespace basegfx
// always creates arcs that are
// positively oriented - flip polygon
// if we swapped angles above
- if( bFlipSegment )
+ if( !bSweepFlag )
aSegment.flip();
aCurrPoly.append(aSegment);
}