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 if (newStartAngle < 0) | 183 |
| 184 if (newStartAngle < 0) { |
184 newStartAngle += twoPiFloat; | 185 newStartAngle += twoPiFloat; |
| 186 // Check for possible catastrophic cancellation in cases where |
| 187 // newStartAngle was a tiny negative number (c.f. crbug.com/503422) |
| 188 if (newStartAngle >= twoPiFloat) |
| 189 newStartAngle -= twoPiFloat; |
| 190 } |
185 | 191 |
186 float delta = newStartAngle - *startAngle; | 192 float delta = newStartAngle - *startAngle; |
187 *startAngle = newStartAngle; | 193 *startAngle = newStartAngle; |
188 *endAngle = *endAngle + delta; | 194 *endAngle = *endAngle + delta; |
189 | 195 |
190 ASSERT(newStartAngle >= 0 && newStartAngle < twoPiFloat); | 196 ASSERT(newStartAngle >= 0 && newStartAngle < twoPiFloat); |
191 } | 197 } |
192 | 198 |
193 /* | 199 /* |
194 * degenerateEllipse() handles a degenerated ellipse using several lines. | 200 * degenerateEllipse() handles a degenerated ellipse using several lines. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 return; | 317 return; |
312 | 318 |
313 if (!width && !height) { | 319 if (!width && !height) { |
314 m_path.moveTo(FloatPoint(x, y)); | 320 m_path.moveTo(FloatPoint(x, y)); |
315 return; | 321 return; |
316 } | 322 } |
317 | 323 |
318 m_path.addRect(FloatRect(x, y, width, height)); | 324 m_path.addRect(FloatRect(x, y, width, height)); |
319 } | 325 } |
320 } | 326 } |
OLD | NEW |