Add support for canvas ellipse method
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Feb 2015 23:40:35 +0000 (23:40 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Feb 2015 23:40:35 +0000 (23:40 +0000)
commitf002d9ec962dfe06501b35ee408fee666743e947
tree6fc71042ec788f1014bd5c742ffffc3fc45f73f5
parentc6d3d1329ec787e307c5b5f837d81de3f40071f6
Add support for canvas ellipse method
https://bugs.webkit.org/show_bug.cgi?id=82791
<rdar://problem/11159172>

Patch by Sam Weinig <sam@webkit.org> on 2015-02-26
Reviewed by Dirk Schulze.

Source/WebCore:

Tests: fast/canvas/canvas-ellipse-360-winding.html
       fast/canvas/canvas-ellipse-circumference-fill.html
       fast/canvas/canvas-ellipse-circumference.html
       fast/canvas/canvas-ellipse-connecting-line.html
       fast/canvas/canvas-ellipse-negative-radius.html
       fast/canvas/canvas-ellipse-zero-lineto.html
       fast/canvas/canvas-ellipse.html

* html/canvas/CanvasPathMethods.h:
* html/canvas/CanvasPathMethods.cpp:
(WebCore::CanvasPathMethods::lineTo):
Convenience for passing a FloatPoint instead of two floats.

(WebCore::normalizeAngles):
Normalizes the angles as described in the HTML spec. Ensuring the startAngle
is greater than 0 and less than 2pi, and the the endAngle is at most 2pi
from the start angle.

(WebCore::CanvasPathMethods::arc):
- Renames some of the parameters to be clearer.
- Normalizes the angles for consistency with ellipse.
- Moves hasInvertibleTransform() higher in the function for consistency.

(WebCore::CanvasPathMethods::ellipse): Added.

* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/DOMPath.idl:
Add ellipse(...).

* platform/graphics/Path.h:
* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::addArc):
Rename parameters for clarity and use a nullptr.

(WebCore::Path::addEllipse):
Added. Constructs an ellipse via a transformed arc.

LayoutTests:

* fast/canvas/canvas-ellipse-360-winding-expected.txt: Added.
* fast/canvas/canvas-ellipse-360-winding.html: Added.
* fast/canvas/canvas-ellipse-circumference-expected.txt: Added.
* fast/canvas/canvas-ellipse-circumference-fill-expected.txt: Added.
* fast/canvas/canvas-ellipse-circumference-fill.html: Added.
* fast/canvas/canvas-ellipse-circumference.html: Added.
* fast/canvas/canvas-ellipse-connecting-line-expected.html: Added.
* fast/canvas/canvas-ellipse-connecting-line.html: Added.
* fast/canvas/canvas-ellipse-expected.txt: Added.
* fast/canvas/canvas-ellipse-negative-radius-expected.txt: Added.
* fast/canvas/canvas-ellipse-negative-radius.html: Added.
* fast/canvas/canvas-ellipse-zero-lineto-expected.txt: Added.
* fast/canvas/canvas-ellipse-zero-lineto.html: Added.
* fast/canvas/canvas-ellipse.html: Added.
* fast/canvas/script-tests/canvas-ellipse-360-winding.js: Added.
* fast/canvas/script-tests/canvas-ellipse.js: Added.
* fast/canvas/script-tests/js-ellipse-implementation.js: Added.
* platform/mac/fast/canvas/canvas-ellipse-circumference-expected.png: Added.
* platform/mac/fast/canvas/canvas-ellipse-circumference-fill-expected.png: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-ellipse-360-winding-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-360-winding.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-circumference-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-circumference-fill-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-circumference-fill.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-circumference.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-connecting-line-expected.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-connecting-line.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-negative-radius-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-negative-radius.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-zero-lineto-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse-zero-lineto.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-ellipse.html [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/canvas-ellipse-360-winding.js [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/canvas-ellipse.js [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/js-ellipse-implementation.js [new file with mode: 0644]
LayoutTests/platform/mac/fast/canvas/canvas-ellipse-circumference-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/canvas/canvas-ellipse-circumference-fill-expected.png [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasPathMethods.cpp
Source/WebCore/html/canvas/CanvasPathMethods.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
Source/WebCore/html/canvas/DOMPath.idl
Source/WebCore/platform/graphics/Path.h
Source/WebCore/platform/graphics/cg/PathCG.cpp