diff options
author | jhaas@chromium.org <jhaas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 21:59:35 +0000 |
---|---|---|
committer | jhaas@chromium.org <jhaas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 21:59:35 +0000 |
commit | aa486e1dc57a3f810325a6863ea8a6b1ef5e0c73 (patch) | |
tree | 370c3353d9426c7fb9a8e27ad3abe273bb25ef9d /webkit | |
parent | 5590f8286b568b29e67f0d575dad0cb84f071e87 (diff) | |
download | chromium_src-aa486e1dc57a3f810325a6863ea8a6b1ef5e0c73.zip chromium_src-aa486e1dc57a3f810325a6863ea8a6b1ef5e0c73.tar.gz chromium_src-aa486e1dc57a3f810325a6863ea8a6b1ef5e0c73.tar.bz2 |
Fix issue 3620
Logic in Path::arc() determines what angle should be passed to Skia for the newly-drawn arc. This was buggy in the case of drawing clockwise arcs where the start angle is greater than the end angle (on an absolute scale). Specifically, some schmuck named jhaas used a minus sign where a plus sign would have worked much better. Honestly I'm flabbergasted this hasn't shown up earlier than this.
Review URL: http://codereview.chromium.org/13756
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/platform/graphics/PathSkia.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/webkit/port/platform/graphics/PathSkia.cpp b/webkit/port/platform/graphics/PathSkia.cpp index d8b5b75..a46db41 100644 --- a/webkit/port/platform/graphics/PathSkia.cpp +++ b/webkit/port/platform/graphics/PathSkia.cpp @@ -143,10 +143,14 @@ void Path::addArc(const FloatPoint& p, float r, float sa, float ea, SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / gPI); SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / gPI); + // Counterclockwise arcs should be drawn with negative sweeps, while + // clockwise arcs should be drawn with positive sweeps. Check to see + // if the situation is reversed and correct it by adding or subtracting + // a full circle if (anticlockwise && sweepDegrees > 0) { sweepDegrees -= SkIntToScalar(360); } else if (!anticlockwise && sweepDegrees < 0) { - sweepDegrees = SkIntToScalar(360) - sweepDegrees; + sweepDegrees += SkIntToScalar(360); } // SkDebugf("addArc sa=%g ea=%g cw=%d start=%g sweep=%g\n", sa, ea, clockwise, |