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

Unified Diff: Source/core/rendering/shapes/PolygonShape.cpp

Issue 170453004: Add constant twoPiDouble/twoPiFloat to MathExtras.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add constant values to header Created 6 years, 10 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') | Source/core/svg/SVGPathParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/shapes/PolygonShape.cpp
diff --git a/Source/core/rendering/shapes/PolygonShape.cpp b/Source/core/rendering/shapes/PolygonShape.cpp
index 041440b40e23f3b475e3e5e7755ad18e1501fe0e..512ae142cd5531051120b82cb4c3204d5396087a 100644
--- a/Source/core/rendering/shapes/PolygonShape.cpp
+++ b/Source/core/rendering/shapes/PolygonShape.cpp
@@ -114,14 +114,13 @@ static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arc
{
float startAngle = atan2(startArcVertex.y() - arcCenter.y(), startArcVertex.x() - arcCenter.x());
float endAngle = atan2(endArcVertex.y() - arcCenter.y(), endArcVertex.x() - arcCenter.x());
- const float twoPI = piFloat * 2;
if (startAngle < 0)
- startAngle += twoPI;
+ startAngle += twoPiFloat;
if (endAngle < 0)
- endAngle += twoPI;
- float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngle + twoPI - endAngle);
+ endAngle += twoPiFloat;
+ float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngle + twoPiFloat - endAngle);
const float arcSegmentCount = 6; // An even number so that one arc vertex will be eactly arcRadius from arcCenter.
- float arcSegmentAngle = ((padding) ? -angle : twoPI - angle) / arcSegmentCount;
+ float arcSegmentAngle = ((padding) ? -angle : twoPiFloat - angle) / arcSegmentCount;
vertices.append(startArcVertex);
for (unsigned i = 1; i < arcSegmentCount; ++i) {
« no previous file with comments | « Source/core/html/canvas/CanvasPathMethods.cpp ('k') | Source/core/svg/SVGPathParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698