Bug 944704, part 4 - Fix PathBuilderCG::Arc to sweep in the correct direction. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Sat, 14 Dec 2013 11:09:36 +0000
changeset 160504 ab057ed707f650241e307525c36877639a5d618d
parent 160503 1bd9d75fe43b1104b1bf1b50b6738e835624de09
child 160505 057d71e9082e933e32771e55bfec9215267f17f2
push id25834
push userphilringnalda@gmail.com
push dateSun, 15 Dec 2013 02:20:53 +0000
treeherdermozilla-central@9fcc6330dc69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs944704
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 944704, part 4 - Fix PathBuilderCG::Arc to sweep in the correct direction. r=Bas
gfx/2d/PathCG.cpp
--- a/gfx/2d/PathCG.cpp
+++ b/gfx/2d/PathCG.cpp
@@ -63,22 +63,30 @@ PathBuilderCG::Close()
   if (!CGPathIsEmpty(mCGPath))
     CGPathCloseSubpath(mCGPath);
 }
 
 void
 PathBuilderCG::Arc(const Point &aOrigin, Float aRadius, Float aStartAngle,
                  Float aEndAngle, bool aAntiClockwise)
 {
+  // Core Graphic's initial coordinate system is y-axis up, whereas Moz2D's is
+  // y-axis down. Core Graphics therefore considers "clockwise" to mean "sweep
+  // in the direction of decreasing angle" whereas Moz2D considers it to mean
+  // "sweep in the direction of increasing angle". In other words if this
+  // Moz2D method is instructed to sweep anti-clockwise we need to tell
+  // CGPathAddArc to sweep clockwise, and vice versa. Hence why we pass the
+  // value of aAntiClockwise directly to CGPathAddArc's "clockwise" bool
+  // parameter.
   CGPathAddArc(mCGPath, nullptr,
                aOrigin.x, aOrigin.y,
                aRadius,
                aStartAngle,
                aEndAngle,
-               !aAntiClockwise);
+               aAntiClockwise);
 }
 
 Point
 PathBuilderCG::CurrentPoint() const
 {
   CGPoint pt = CGPathGetCurrentPoint(mCGPath);
   Point ret(pt.x, pt.y);
   return ret;