Chromium Code Reviews

Side by Side Diff: LayoutTests/fast/canvas/script-tests/js-ellipse-implementation.js

Issue 14298022: Add support for new canvas ellipse method. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to upstream. Make canvas-ellipse-circumference cover more extensive cases. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 function rad2deg(x) {
2 return x * 180 / Math.PI;
3 }
4
5 function ellipseUsingArc(context, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)
6 {
7 var transform = new WebKitCSSMatrix();
8 transform = transform.translate(x, y);
9 transform = transform.rotate(rad2deg(rotation));
10 transform = transform.scale(radiusX, radiusY);
11
12 /*
13 Use WebKitCSSMatrix instead of as follows, because using WebKitCSSMatrix com putes float values more precisely.
14 It is because we don't want to fail pixel comparison due to float precision.
15 context.translate(x, y);
16 context.rotate(rotation);
17 context.scale(radiusX, radiusY);
18 */
19 context.save();
20 context.transform(transform.a, transform.b, transform.c, transform.d, transf orm.e, transform.f);
21 context.arc(0, 0, 1, startAngle, endAngle, anticlockwise);
22 context.restore();
23 }
24
OLDNEW

Powered by Google App Engine