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

Unified Diff: LayoutTests/fast/canvas/canvas-arc-circumference.html

Issue 18286007: Fix edge case bugs of canvas arc. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@ellipse
Patch Set: Test uses alpha color to check darkening of paths on the double-rasterized region. 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/canvas-arc-circumference.html
diff --git a/LayoutTests/fast/canvas/canvas-arc-circumference.html b/LayoutTests/fast/canvas/canvas-arc-circumference.html
new file mode 100644
index 0000000000000000000000000000000000000000..1a8695bb08d8fb5e607a0499a2c18d3e50d4cb29
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-arc-circumference.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head></head>
+<body>
+<canvas id="mycanvas" width="600" height="400"></canvas>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText(true);
+
+var canvas = document.getElementById('mycanvas');
+var ctx = canvas.getContext('2d');
+
+ctx.lineWidth = 3;
+ctx.strokeStyle = 'rgba(0, 0, 0, 0.5)';
+
+// 20 angles.
+var sweepAngles = [
+ -123.7, -2.3, -2, -1, -0.3, -0.000001, 0, 0.000001, 0.3, 0.7,
+ 1, 1.3, 1.5, 1.7, 1.99999, 2, 2.00001, 2.3, 4.3, 3934723942837.3
+];
+for (var i = 0; i < sweepAngles.length; i++) {
+ sweepAngles[i] = sweepAngles[i] * Math.PI;
+}
+
+var startAngles = [
+ -1, -0.5, 0, 0.5
+]
+for (var i = 0; i < startAngles.length; i++) {
+ startAngles[i] = startAngles[i] * Math.PI;
+}
+
+var startAngle = 0;
+var anticlockwise = false;
+var sign = 1;
+for (var i = 0; i < startAngles.length * 2; i++) {
+ if (i == startAngles.length) {
+ anticlockwise = true;
+ sign = -1;
+ }
+ startAngle = startAngles[i % startAngles.length] * sign;
+ ctx.save();
+ for (var j = 0; j < sweepAngles.length; j++) {
+ ctx.save();
+ ctx.beginPath();
+ ctx.moveTo(0, 2);
+ ctx.arc(18, 15, 10, startAngle, startAngle + (sweepAngles[j] * sign), anticlockwise);
+ ctx.lineTo(0, 28);
+ ctx.stroke();
+ ctx.restore();
+ ctx.translate(30, 0);
+ }
+ ctx.restore();
+ ctx.translate(0, 40);
+}
+
+</script>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698