| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 | 2 |
| 3 <!-- READ BEFORE UPDATING: | 3 <!-- READ BEFORE UPDATING: |
| 4 If this test is updated make sure to increment the "revision" value of the | 4 If this test is updated make sure to increment the "revision" value of the |
| 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure | 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure |
| 6 that the baseline images are regenerated on the next run. | 6 that the baseline images are regenerated on the next run. |
| 7 --> | 7 --> |
| 8 | 8 |
| 9 <html> | 9 <html> |
| 10 <head> | 10 <head> |
| 11 <title>Accelerated Canvas 2D Test: Red Box over Black Background</title> | 11 <title>Accelerated Retina Canvas 2D and WebGL Test: Red Box and Green Triangle o
ver Black Background</title> |
| 12 <style type="text/css"> | 12 <style type="text/css"> |
| 13 .nomargin { | 13 .nomargin { |
| 14 margin: 0px auto; | 14 margin: 0px auto; |
| 15 } | 15 } |
| 16 </style> | 16 </style> |
| 17 |
| 18 <script src="pixel_webgl_util.js"></script> |
| 19 |
| 17 <script> | 20 <script> |
| 18 var g_swapsBeforeAck = 15; | 21 var g_swapsBeforeAck = 15; |
| 22 var gl; |
| 19 | 23 |
| 20 function main() | 24 function main() |
| 21 { | 25 { |
| 22 draw(); | 26 draw(); |
| 23 waitForFinish(); | 27 waitForFinish(); |
| 24 } | 28 } |
| 25 | 29 |
| 26 function draw() | 30 function draw() |
| 27 { | 31 { |
| 28 var canvas = document.getElementById("c"); | 32 var canvas = document.getElementById("c"); |
| 33 canvas.style.width = canvas.style.height = "150px"; |
| 29 var c2d = canvas.getContext("2d"); | 34 var c2d = canvas.getContext("2d"); |
| 30 c2d.clearRect(0, 0, canvas.width, canvas.height); | 35 c2d.clearRect(0, 0, canvas.width, canvas.height); |
| 31 c2d.fillStyle = "rgba(255, 0, 0, 0.5)"; | 36 c2d.fillStyle = "rgba(255, 0, 0, 0.5)"; |
| 32 c2d.fillRect(50, 50, 100, 100); | 37 c2d.fillRect(50, 50, 100, 100); |
| 38 |
| 39 var webglCanvas = document.getElementById("c2"); |
| 40 gl = initGL(webglCanvas); |
| 41 if (!setup(gl)) { |
| 42 domAutomationController.setAutomationId(1); |
| 43 domAutomationController.send("FAILURE"); |
| 44 } |
| 33 } | 45 } |
| 34 | 46 |
| 35 function waitForFinish() | 47 function waitForFinish() |
| 36 { | 48 { |
| 37 if (g_swapsBeforeAck == 0) { | 49 if (g_swapsBeforeAck == 0) { |
| 38 domAutomationController.setAutomationId(1); | 50 domAutomationController.setAutomationId(1); |
| 39 domAutomationController.send("SUCCESS"); | 51 domAutomationController.send("SUCCESS"); |
| 40 } else { | 52 } else { |
| 41 g_swapsBeforeAck--; | 53 g_swapsBeforeAck--; |
| 42 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; | 54 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; |
| 55 drawTriangle(gl); |
| 43 window.webkitRequestAnimationFrame(waitForFinish); | 56 window.webkitRequestAnimationFrame(waitForFinish); |
| 44 } | 57 } |
| 45 } | 58 } |
| 46 </script> | 59 </script> |
| 47 </head> | 60 </head> |
| 48 <body onload="main()"> | 61 <body onload="main()"> |
| 49 <div style="position:relative; width:300px; height:300px; background-color:black
"> | 62 <div style="position:relative; width:400px; height:400px; background-color:black
"> |
| 50 </div> | 63 </div> |
| 51 <div id="container" style="position:absolute; top:0px; left:0px"> | 64 <div id="container" style="position:absolute; top:0px; left:0px"> |
| 52 <!-- | 65 <!-- |
| 53 Canvas acceleration requires that the canvas be at least 256x257. | 66 Canvas acceleration requires that the canvas be at least 256x257. |
| 54 --> | 67 --> |
| 55 <canvas id="c" width="300" height="300" class="nomargin"></canvas> | 68 <canvas id="c" width="300" height="300" class="nomargin"></canvas> |
| 69 <canvas id="c2" width="300" height="300" class="nomargin"></canvas> |
| 56 </div> | 70 </div> |
| 57 </body> | 71 </body> |
| 58 </html> | 72 </html> |
| OLD | NEW |