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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 * NOTE: Before ellipse() calls this function, adjustEndAngle() is called, so en
dAngle - startAngle must be equal to or less than 2Pi. | 223 * NOTE: Before ellipse() calls this function, adjustEndAngle() is called, so en
dAngle - startAngle must be equal to or less than 2Pi. |
224 */ | 224 */ |
225 void degenerateEllipse(CanvasPathMethods* path, float x, float y, float radiusX,
float radiusY, float rotation, float startAngle, float endAngle, bool anticlock
wise) | 225 void degenerateEllipse(CanvasPathMethods* path, float x, float y, float radiusX,
float radiusY, float rotation, float startAngle, float endAngle, bool anticlock
wise) |
226 { | 226 { |
227 ASSERT(ellipseIsRenderable(startAngle, endAngle)); | 227 ASSERT(ellipseIsRenderable(startAngle, endAngle)); |
228 ASSERT(startAngle >= 0 && startAngle < twoPiFloat); | 228 ASSERT(startAngle >= 0 && startAngle < twoPiFloat); |
229 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise &&
(endAngle - startAngle) >= 0)); | 229 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise &&
(endAngle - startAngle) >= 0)); |
230 | 230 |
231 FloatPoint center(x, y); | 231 FloatPoint center(x, y); |
232 AffineTransform rotationMatrix; | 232 AffineTransform rotationMatrix; |
233 rotationMatrix.rotate(rad2deg(rotation)); | 233 rotationMatrix.rotateRadians(rotation); |
234 // First, if the object's path has any subpaths, then the method must add a
straight line from the last point in the subpath to the start point of the arc. | 234 // First, if the object's path has any subpaths, then the method must add a
straight line from the last point in the subpath to the start point of the arc. |
235 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEllipse(ra
diusX, radiusY, startAngle))); | 235 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEllipse(ra
diusX, radiusY, startAngle))); |
236 if ((!radiusX && !radiusY) || startAngle == endAngle) | 236 if ((!radiusX && !radiusY) || startAngle == endAngle) |
237 return; | 237 return; |
238 | 238 |
239 if (!anticlockwise) { | 239 if (!anticlockwise) { |
240 // startAngle - fmodf(startAngle, piOverTwoFloat) + piOverTwoFloat is th
e one of (0, 0.5Pi, Pi, 1.5Pi, 2Pi) | 240 // startAngle - fmodf(startAngle, piOverTwoFloat) + piOverTwoFloat is th
e one of (0, 0.5Pi, Pi, 1.5Pi, 2Pi) |
241 // that is the closest to startAngle on the clockwise direction. | 241 // that is the closest to startAngle on the clockwise direction. |
242 for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat) + piOv
erTwoFloat; angle < endAngle; angle += piOverTwoFloat) | 242 for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat) + piOv
erTwoFloat; angle < endAngle; angle += piOverTwoFloat) |
243 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEl
lipse(radiusX, radiusY, angle))); | 243 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEl
lipse(radiusX, radiusY, angle))); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return; | 312 return; |
313 | 313 |
314 if (!width && !height) { | 314 if (!width && !height) { |
315 m_path.moveTo(FloatPoint(x, y)); | 315 m_path.moveTo(FloatPoint(x, y)); |
316 return; | 316 return; |
317 } | 317 } |
318 | 318 |
319 m_path.addRect(FloatRect(x, y, width, height)); | 319 m_path.addRect(FloatRect(x, y, width, height)); |
320 } | 320 } |
321 } | 321 } |
OLD | NEW |