Chromium Code Reviews

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: Update layout tests Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: Source/core/platform/graphics/Path.cpp
diff --git a/Source/core/platform/graphics/Path.cpp b/Source/core/platform/graphics/Path.cpp
index f70126594af34acf02f8ae71ceb686aa18ca0440..0a814183a58a750fc85aa090b58c68ad8b7c869b 100644
--- a/Source/core/platform/graphics/Path.cpp
+++ b/Source/core/platform/graphics/Path.cpp
@@ -263,18 +263,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) {

Powered by Google App Engine