Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-ellipse-circumference-fill.html
blobd494861e9ae180bad736983c501e926cefb0d4b9
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 <canvas id="mycanvas" width="600" height="480"></canvas>
6 <script>
7 if (window.testRunner)
8 testRunner.dumpAsTextWithPixelResults();
10 var canvas = document.getElementById('mycanvas');
11 var ctx = canvas.getContext('2d');
13 ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
15 // 20 angles.
16 var sweepAngles = [
17 -123.7, -2.3, -2, -1, -0.3, -0.000001, 0, 0.000001, 0.3, 0.7,
18 1, 1.3, 1.5, 1.7, 1.99999, 2, 2.00001, 2.3, 4.3, 3934723942837.3
20 for (var i = 0; i < sweepAngles.length; i++) {
21 sweepAngles[i] = sweepAngles[i] * Math.PI;
24 var startAngles = [
25 -1, -0.5, 0, 0.5
27 for (var i = 0; i < startAngles.length; i++) {
28 startAngles[i] = startAngles[i] * Math.PI;
31 var rotations = [
32 Math.PI / 4, 0
35 var startAngle = 0;
36 var anticlockwise = false;
37 var sign = 1;
38 var height = 30;
39 for (var r = 0; r < rotations.length; r++) {
40 ctx.save();
41 for (var i = 0; i < startAngles.length * 2; i++) {
42 if (i == startAngles.length) {
43 anticlockwise = true;
44 sign = -1;
46 startAngle = startAngles[i % startAngles.length] * sign;
47 ctx.save();
48 for (var j = 0; j < sweepAngles.length; j++) {
49 ctx.save();
50 ctx.beginPath();
51 ctx.moveTo(0, 2);
52 ctx.ellipse(18, 15, 8, 12, rotations[r], startAngle, startAngle + (sweepAngles[j] * sign), anticlockwise);
53 ctx.lineTo(0, 28);
54 ctx.fill();
55 ctx.restore();
56 ctx.translate(30, 0);
58 ctx.restore();
59 ctx.translate(0, height);
61 ctx.restore();
62 ctx.translate(0, height * startAngles.length * 2);
65 </script>
66 </body>
67 </html>