From 452b6c3fcf3e617d35a5138f706dd3e062828fa0 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Sat, 14 Dec 2013 11:09:36 +0000 Subject: [PATCH] Bug 944704, part 4 - Fix PathBuilderCG::Arc to sweep in the correct direction. r=Bas --- gfx/2d/PathCG.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gfx/2d/PathCG.cpp b/gfx/2d/PathCG.cpp index de1205b7cd3c..322731407a62 100644 --- a/gfx/2d/PathCG.cpp +++ b/gfx/2d/PathCG.cpp @@ -68,12 +68,20 @@ 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