Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
| 9 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. |
| 10 * | 10 * |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 173 |
| 174 inline FloatPoint getPointOnEllipse(float radiusX, float radiusY, float theta) | 174 inline FloatPoint getPointOnEllipse(float radiusX, float radiusY, float theta) |
| 175 { | 175 { |
| 176 return FloatPoint(radiusX * cosf(theta), radiusY * sinf(theta)); | 176 return FloatPoint(radiusX * cosf(theta), radiusY * sinf(theta)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void canonicalizeAngle(float* startAngle, float* endAngle) | 179 void canonicalizeAngle(float* startAngle, float* endAngle) |
| 180 { | 180 { |
| 181 // Make 0 <= startAngle < 2*PI | 181 // Make 0 <= startAngle < 2*PI |
| 182 float newStartAngle = fmodf(*startAngle, twoPiFloat); | 182 float newStartAngle = fmodf(*startAngle, twoPiFloat); |
| 183 | |
| 183 if (newStartAngle < 0) | 184 if (newStartAngle < 0) |
| 184 newStartAngle += twoPiFloat; | 185 newStartAngle += twoPiFloat; |
| 185 | 186 |
| 187 // Compensate for numerical precision issues in fmodf (c.f. crbug.com/503422 ) | |
|
Stephen White
2015/06/26 15:38:21
This is probably just loss of precision on the + a
| |
| 188 if (newStartAngle >= twoPiFloat) | |
| 189 newStartAngle -= twoPiFloat; | |
| 190 | |
| 186 float delta = newStartAngle - *startAngle; | 191 float delta = newStartAngle - *startAngle; |
| 187 *startAngle = newStartAngle; | 192 *startAngle = newStartAngle; |
| 188 *endAngle = *endAngle + delta; | 193 *endAngle = *endAngle + delta; |
| 189 | 194 |
| 190 ASSERT(newStartAngle >= 0 && newStartAngle < twoPiFloat); | 195 ASSERT(newStartAngle >= 0 && newStartAngle < twoPiFloat); |
| 191 } | 196 } |
| 192 | 197 |
| 193 /* | 198 /* |
| 194 * degenerateEllipse() handles a degenerated ellipse using several lines. | 199 * degenerateEllipse() handles a degenerated ellipse using several lines. |
| 195 * | 200 * |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 return; | 316 return; |
| 312 | 317 |
| 313 if (!width && !height) { | 318 if (!width && !height) { |
| 314 m_path.moveTo(FloatPoint(x, y)); | 319 m_path.moveTo(FloatPoint(x, y)); |
| 315 return; | 320 return; |
| 316 } | 321 } |
| 317 | 322 |
| 318 m_path.addRect(FloatRect(x, y, width, height)); | 323 m_path.addRect(FloatRect(x, y, width, height)); |
| 319 } | 324 } |
| 320 } | 325 } |
| OLD | NEW |