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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
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 = *startAngle; | 182 float newStartAngle = fmodf(*startAngle, twoPiFloat); |
183 if (newStartAngle < 0) | 183 if (newStartAngle < 0) |
184 newStartAngle = twoPiFloat + fmodf(newStartAngle, -twoPiFloat); | 184 newStartAngle += twoPiFloat; |
185 else | |
186 newStartAngle = fmodf(newStartAngle, twoPiFloat); | |
187 | 185 |
188 float delta = newStartAngle - *startAngle; | 186 float delta = newStartAngle - *startAngle; |
189 *startAngle = newStartAngle; | 187 *startAngle = newStartAngle; |
190 *endAngle = *endAngle + delta; | 188 *endAngle = *endAngle + delta; |
| 189 |
191 ASSERT(newStartAngle >= 0 && newStartAngle < twoPiFloat); | 190 ASSERT(newStartAngle >= 0 && newStartAngle < twoPiFloat); |
192 } | 191 } |
193 | 192 |
194 /* | 193 /* |
195 * degenerateEllipse() handles a degenerated ellipse using several lines. | 194 * degenerateEllipse() handles a degenerated ellipse using several lines. |
196 * | 195 * |
197 * Let's see a following example: line to ellipse to line. | 196 * Let's see a following example: line to ellipse to line. |
198 * _--^\ | 197 * _--^\ |
199 * ( ) | 198 * ( ) |
200 * -----( ) | 199 * -----( ) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return; | 311 return; |
313 | 312 |
314 if (!width && !height) { | 313 if (!width && !height) { |
315 m_path.moveTo(FloatPoint(x, y)); | 314 m_path.moveTo(FloatPoint(x, y)); |
316 return; | 315 return; |
317 } | 316 } |
318 | 317 |
319 m_path.addRect(FloatRect(x, y, width, height)); | 318 m_path.addRect(FloatRect(x, y, width, height)); |
320 } | 319 } |
321 } | 320 } |
OLD | NEW |