Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified 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: Make canvas-ellipse-360-winding.html for virtual/gpu pass. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/canvas/script-tests/js-ellipse-implementation.js
diff --git a/LayoutTests/fast/canvas/script-tests/js-ellipse-implementation.js b/LayoutTests/fast/canvas/script-tests/js-ellipse-implementation.js
new file mode 100644
index 0000000000000000000000000000000000000000..7409a75839bca5a38fb4d6106dc5214567452594
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/js-ellipse-implementation.js
@@ -0,0 +1,24 @@
+function rad2deg(x) {
+ return x * 180 / Math.PI;
+}
+
+function ellipseUsingArc(context, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)
+{
+ var transform = new WebKitCSSMatrix();
+ transform = transform.translate(x, y);
+ transform = transform.rotate(rad2deg(rotation));
+ transform = transform.scale(radiusX, radiusY);
+
+ /*
+ Use WebKitCSSMatrix instead of as follows, because using WebKitCSSMatrix computes float values more precisely.
+ It is because we don't want to fail pixel comparison due to float precision.
+ context.translate(x, y);
+ context.rotate(rotation);
+ context.scale(radiusX, radiusY);
+ */
+ context.save();
+ context.transform(transform.a, transform.b, transform.c, transform.d, transform.e, transform.f);
+ context.arc(0, 0, 1, startAngle, endAngle, anticlockwise);
+ context.restore();
+}
+
« no previous file with comments | « LayoutTests/fast/canvas/script-tests/canvas-ellipse-360-winding.js ('k') | Source/core/html/canvas/CanvasPathMethods.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698