| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (!m_path.hasCurrentPoint()) | 100 if (!m_path.hasCurrentPoint()) |
| 101 m_path.moveTo(FloatPoint(cp1x, cp1y)); | 101 m_path.moveTo(FloatPoint(cp1x, cp1y)); |
| 102 | 102 |
| 103 FloatPoint p1 = FloatPoint(x, y); | 103 FloatPoint p1 = FloatPoint(x, y); |
| 104 FloatPoint cp1 = FloatPoint(cp1x, cp1y); | 104 FloatPoint cp1 = FloatPoint(cp1x, cp1y); |
| 105 FloatPoint cp2 = FloatPoint(cp2x, cp2y); | 105 FloatPoint cp2 = FloatPoint(cp2x, cp2y); |
| 106 if (p1 != m_path.currentPoint() || p1 != cp1 || p1 != cp2) | 106 if (p1 != m_path.currentPoint() || p1 != cp1 || p1 != cp2) |
| 107 m_path.addBezierCurveTo(cp1, cp2, p1); | 107 m_path.addBezierCurveTo(cp1, cp2, p1); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void CanvasPathMethods::arcTo(float x1, float y1, float x2, float y2, float r, E
xceptionState& es) | 110 void CanvasPathMethods::arcTo(float x1, float y1, float x2, float y2, float r, E
xceptionState& exceptionState) |
| 111 { | 111 { |
| 112 if (!std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(x2) || !std::
isfinite(y2) || !std::isfinite(r)) | 112 if (!std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(x2) || !std::
isfinite(y2) || !std::isfinite(r)) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 if (r < 0) { | 115 if (r < 0) { |
| 116 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 116 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (!isTransformInvertible()) | 120 if (!isTransformInvertible()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 FloatPoint p1 = FloatPoint(x1, y1); | 123 FloatPoint p1 = FloatPoint(x1, y1); |
| 124 FloatPoint p2 = FloatPoint(x2, y2); | 124 FloatPoint p2 = FloatPoint(x2, y2); |
| 125 | 125 |
| 126 if (!m_path.hasCurrentPoint()) | 126 if (!m_path.hasCurrentPoint()) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } else { | 246 } else { |
| 247 for (float angle = startAngle - fmodf(startAngle, halfPiFloat); angle >
endAngle; angle -= halfPiFloat) | 247 for (float angle = startAngle - fmodf(startAngle, halfPiFloat); angle >
endAngle; angle -= halfPiFloat) |
| 248 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEl
lipse(radiusX, radiusY, angle))); | 248 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEl
lipse(radiusX, radiusY, angle))); |
| 249 } | 249 } |
| 250 | 250 |
| 251 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEllipse(ra
diusX, radiusY, endAngle))); | 251 lineToFloatPoint(path, center + rotationMatrix.mapPoint(getPointOnEllipse(ra
diusX, radiusY, endAngle))); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace | 254 } // namespace |
| 255 | 255 |
| 256 void CanvasPathMethods::arc(float x, float y, float radius, float startAngle, fl
oat endAngle, bool anticlockwise, ExceptionState& es) | 256 void CanvasPathMethods::arc(float x, float y, float radius, float startAngle, fl
oat endAngle, bool anticlockwise, ExceptionState& exceptionState) |
| 257 { | 257 { |
| 258 if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radius) || !std
::isfinite(startAngle) || !std::isfinite(endAngle)) | 258 if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radius) || !std
::isfinite(startAngle) || !std::isfinite(endAngle)) |
| 259 return; | 259 return; |
| 260 | 260 |
| 261 if (radius < 0) { | 261 if (radius < 0) { |
| 262 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 262 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 | 265 |
| 266 if (!isTransformInvertible()) | 266 if (!isTransformInvertible()) |
| 267 return; | 267 return; |
| 268 | 268 |
| 269 if (!radius || startAngle == endAngle) { | 269 if (!radius || startAngle == endAngle) { |
| 270 // The arc is empty but we still need to draw the connecting line. | 270 // The arc is empty but we still need to draw the connecting line. |
| 271 lineTo(x + radius * cosf(startAngle), y + radius * sinf(startAngle)); | 271 lineTo(x + radius * cosf(startAngle), y + radius * sinf(startAngle)); |
| 272 return; | 272 return; |
| 273 } | 273 } |
| 274 | 274 |
| 275 canonicalizeAngle(&startAngle, &endAngle); | 275 canonicalizeAngle(&startAngle, &endAngle); |
| 276 float adjustedEndAngle = adjustEndAngle(startAngle, endAngle, anticlockwise)
; | 276 float adjustedEndAngle = adjustEndAngle(startAngle, endAngle, anticlockwise)
; |
| 277 m_path.addArc(FloatPoint(x, y), radius, startAngle, adjustedEndAngle, anticl
ockwise); | 277 m_path.addArc(FloatPoint(x, y), radius, startAngle, adjustedEndAngle, anticl
ockwise); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void CanvasPathMethods::ellipse(float x, float y, float radiusX, float radiusY,
float rotation, float startAngle, float endAngle, bool anticlockwise, ExceptionS
tate& es) | 280 void CanvasPathMethods::ellipse(float x, float y, float radiusX, float radiusY,
float rotation, float startAngle, float endAngle, bool anticlockwise, ExceptionS
tate& exceptionState) |
| 281 { | 281 { |
| 282 if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radiusX) || !st
d::isfinite(radiusY) || !std::isfinite(rotation) || !std::isfinite(startAngle) |
| !std::isfinite(endAngle)) | 282 if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radiusX) || !st
d::isfinite(radiusY) || !std::isfinite(rotation) || !std::isfinite(startAngle) |
| !std::isfinite(endAngle)) |
| 283 return; | 283 return; |
| 284 | 284 |
| 285 if (radiusX < 0 || radiusY < 0) { | 285 if (radiusX < 0 || radiusY < 0) { |
| 286 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 286 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 287 return; | 287 return; |
| 288 } | 288 } |
| 289 | 289 |
| 290 if (!isTransformInvertible()) | 290 if (!isTransformInvertible()) |
| 291 return; | 291 return; |
| 292 | 292 |
| 293 canonicalizeAngle(&startAngle, &endAngle); | 293 canonicalizeAngle(&startAngle, &endAngle); |
| 294 float adjustedEndAngle = adjustEndAngle(startAngle, endAngle, anticlockwise)
; | 294 float adjustedEndAngle = adjustEndAngle(startAngle, endAngle, anticlockwise)
; |
| 295 if (!radiusX || !radiusY || startAngle == adjustedEndAngle) { | 295 if (!radiusX || !radiusY || startAngle == adjustedEndAngle) { |
| 296 // The ellipse is empty but we still need to draw the connecting line to
start point. | 296 // The ellipse is empty but we still need to draw the connecting line to
start point. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 310 return; | 310 return; |
| 311 | 311 |
| 312 if (!width && !height) { | 312 if (!width && !height) { |
| 313 m_path.moveTo(FloatPoint(x, y)); | 313 m_path.moveTo(FloatPoint(x, y)); |
| 314 return; | 314 return; |
| 315 } | 315 } |
| 316 | 316 |
| 317 m_path.addRect(FloatRect(x, y, width, height)); | 317 m_path.addRect(FloatRect(x, y, width, height)); |
| 318 } | 318 } |
| 319 } | 319 } |
| OLD | NEW |