Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1249)

Unified Diff: Source/core/platform/graphics/Path.cpp

Issue 18286007: Fix edge case bugs of canvas arc. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@ellipse
Patch Set: Test uses alpha color to check darkening of paths on the double-rasterized region. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/canvas/CanvasPathMethods.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/Path.cpp
diff --git a/Source/core/platform/graphics/Path.cpp b/Source/core/platform/graphics/Path.cpp
index b07d65942c522ae75b038963922c9ca84ee5a7a6..bb66e31a991bccca391548fa4a3ec8457386968a 100644
--- a/Source/core/platform/graphics/Path.cpp
+++ b/Source/core/platform/graphics/Path.cpp
@@ -276,18 +276,18 @@ void Path::closeSubpath()
m_path.close();
}
-void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlockwise)
+void Path::addArc(const FloatPoint& p, float radius, float startAngle, float endAngle, bool anticlockwise)
{
SkScalar cx = WebCoreFloatToSkScalar(p.x());
SkScalar cy = WebCoreFloatToSkScalar(p.y());
- SkScalar radius = WebCoreFloatToSkScalar(r);
+ SkScalar radiusScalar = WebCoreFloatToSkScalar(radius);
SkScalar s360 = SkIntToScalar(360);
SkRect oval;
- oval.set(cx - radius, cy - radius, cx + radius, cy + radius);
+ oval.set(cx - radiusScalar, cy - radiusScalar, cx + radiusScalar, cy + radiusScalar);
- float sweep = ea - sa;
- SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / piFloat);
+ float sweep = endAngle - startAngle;
+ SkScalar startDegrees = WebCoreFloatToSkScalar(startAngle * 180 / piFloat);
SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat);
// Check for a circle.
if (sweepDegrees >= s360 || sweepDegrees <= -s360) {
« no previous file with comments | « Source/core/html/canvas/CanvasPathMethods.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698