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

Unified Diff: Source/core/html/canvas/CanvasPathMethods.cpp

Issue 1212423002: Fixing bad angle computation in 2D canvas arc rendering (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nit fix Created 5 years, 6 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 | « LayoutTests/fast/canvas/bug503422-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/CanvasPathMethods.cpp
diff --git a/Source/core/html/canvas/CanvasPathMethods.cpp b/Source/core/html/canvas/CanvasPathMethods.cpp
index 85a13a49e65878d060ad0f58e72d77facd684638..3d9ccd2ab2e584e04a50fc0260d2c36876737e73 100644
--- a/Source/core/html/canvas/CanvasPathMethods.cpp
+++ b/Source/core/html/canvas/CanvasPathMethods.cpp
@@ -180,8 +180,14 @@ void canonicalizeAngle(float* startAngle, float* endAngle)
{
// Make 0 <= startAngle < 2*PI
float newStartAngle = fmodf(*startAngle, twoPiFloat);
- if (newStartAngle < 0)
+
+ if (newStartAngle < 0) {
newStartAngle += twoPiFloat;
+ // Check for possible catastrophic cancellation in cases where
+ // newStartAngle was a tiny negative number (c.f. crbug.com/503422)
+ if (newStartAngle >= twoPiFloat)
+ newStartAngle -= twoPiFloat;
+ }
float delta = newStartAngle - *startAngle;
*startAngle = newStartAngle;
« no previous file with comments | « LayoutTests/fast/canvas/bug503422-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698