| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>WebGL Scissor with context of preserveDrawingBuffer=true</title> | 4 <title>WebGL Scissor with context of preserveDrawingBuffer=true</title> |
| 5 <style type="text/css"> | 5 <style type="text/css"> |
| 6 .nomargin { | 6 .nomargin { |
| 7 margin: 0px auto; | 7 margin: 0px auto; |
| 8 } | 8 } |
| 9 </style> | 9 </style> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 | 12 |
| 13 function run() { | 13 function run() { |
| 14 var canvas = document.getElementById("c"); | 14 var canvas = document.getElementById("c"); |
| 15 gl = initGL(canvas); | 15 gl = initGL(canvas); |
| 16 if (!gl) { | 16 if (!gl) { |
| 17 domAutomationController.setAutomationId(1); | |
| 18 domAutomationController.send("FAILURE"); | 17 domAutomationController.send("FAILURE"); |
| 19 return; | 18 return; |
| 20 } | 19 } |
| 21 gl.clearColor(1, 0, 0, 1); | 20 gl.clearColor(1, 0, 0, 1); |
| 22 gl.clear(gl.COLOR_BUFFER_BIT); | 21 gl.clear(gl.COLOR_BUFFER_BIT); |
| 23 window.requestAnimationFrame(scissorAndClear); | 22 window.requestAnimationFrame(scissorAndClear); |
| 24 } | 23 } |
| 25 | 24 |
| 26 function initGL(canvas) { | 25 function initGL(canvas) { |
| 27 var gl = null; | 26 var gl = null; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 gl.clearColor(0, 1, 0, 1); | 37 gl.clearColor(0, 1, 0, 1); |
| 39 gl.clear(gl.COLOR_BUFFER_BIT); | 38 gl.clear(gl.COLOR_BUFFER_BIT); |
| 40 | 39 |
| 41 deferredAck(); | 40 deferredAck(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 var swapsBeforeAck = 15; | 43 var swapsBeforeAck = 15; |
| 45 function deferredAck() | 44 function deferredAck() |
| 46 { | 45 { |
| 47 if (swapsBeforeAck == 0) { | 46 if (swapsBeforeAck == 0) { |
| 48 domAutomationController.setAutomationId(1); | |
| 49 domAutomationController.send("SUCCESS"); | 47 domAutomationController.send("SUCCESS"); |
| 50 } else { | 48 } else { |
| 51 --swapsBeforeAck; | 49 --swapsBeforeAck; |
| 52 window.requestAnimationFrame(deferredAck); | 50 window.requestAnimationFrame(deferredAck); |
| 53 } | 51 } |
| 54 } | 52 } |
| 55 | 53 |
| 56 </script> | 54 </script> |
| 57 </head> | 55 </head> |
| 58 <body onload="run()"> | 56 <body onload="run()"> |
| 59 <div style="position:absolute; top:0px; left:0px"> | 57 <div style="position:absolute; top:0px; left:0px"> |
| 60 <canvas id="c" width="200" height="200" class="nomargin"></canvas> | 58 <canvas id="c" width="200" height="200" class="nomargin"></canvas> |
| 61 </div> | 59 </div> |
| 62 </body> | 60 </body> |
| 63 </html> | 61 </html> |
| OLD | NEW |