OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html lang="en"> | 2 <html lang="en"> |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
5 <title>Canvas Incremental Repaint</title> | 5 <title>Canvas Incremental Repaint</title> |
6 <style type="text/css" media="screen"> | 6 <style type="text/css" media="screen"> |
7 canvas { | 7 canvas { |
8 width: 200px; | 8 width: 200px; |
9 height: 150px; | 9 height: 150px; |
10 border: 20px solid black; | 10 border: 20px solid black; |
11 } | 11 } |
12 </style> | 12 </style> |
| 13 <script src="resources/repaint.js"></script> |
13 <script type="text/javascript" charset="utf-8"> | 14 <script type="text/javascript" charset="utf-8"> |
14 | 15 |
15 if (window.testRunner) { | 16 if (window.testRunner) { |
16 testRunner.dumpAsTextWithPixelResults(); | 17 testRunner.dumpAsTextWithPixelResults(); |
17 testRunner.waitUntilDone(); | |
18 } | 18 } |
19 | 19 |
20 function runRepaintTest() | |
21 { | |
22 if (window.testRunner) { | |
23 document.body.offsetTop; | |
24 testRunner.display(); | |
25 repaintTest(); | |
26 testRunner.notifyDone(); | |
27 } else { | |
28 setTimeout(repaintTest, 0); | |
29 } | |
30 } | |
31 | |
32 function repaintTest() | 20 function repaintTest() |
33 { | 21 { |
34 var canvas = document.getElementById('canvas1'); | 22 var canvas = document.getElementById('canvas1'); |
35 var ctx = canvas.getContext('2d'); | 23 var ctx = canvas.getContext('2d'); |
36 | 24 |
37 ctx.fillStyle = 'green'; | 25 ctx.fillStyle = 'green'; |
38 | 26 |
39 ctx.save(); | 27 ctx.save(); |
40 ctx.setTransform(1, 0, 0, 1, 50, 200); | 28 ctx.setTransform(1, 0, 0, 1, 50, 200); |
41 // Test the the transform applies the matrix in the correct order. | 29 // Test the the transform applies the matrix in the correct order. |
42 ctx.transform(1, 0, 0, -1, 0, 0); | 30 ctx.transform(1, 0, 0, -1, 0, 0); |
43 ctx.fillRect(0, 100, 200, 80); | 31 ctx.fillRect(0, 100, 200, 80); |
44 ctx.restore(); | 32 ctx.restore(); |
45 } | 33 } |
46 | 34 |
47 </script> | 35 </script> |
48 </head> | 36 </head> |
49 <body onload="runRepaintTest()"> | 37 <body onload="runRepaintTest()"> |
50 <canvas id="canvas1"></canvas> | 38 <canvas id="canvas1"></canvas> |
51 </body> | 39 </body> |
52 </html> | 40 </html> |
OLD | NEW |