1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25

content / test / data / gpu / screenshot_sync_canvas.html [blame]

<!DOCTYPE html>
<html>
<head>
<title>Synchronized screenshot test with canvas</title>
<style>
  html, body { margin: 0; }
</style>
</head>
<body>
  <canvas id="canvas" width="256" height="256" style="position: absolute; left; 0px; top: 0px;"></canvas>
  <div id="text"></div>

  <script>
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");
    var text = document.getElementById("text");
    function draw(r, g, b) {
      var rgb = "RGB(" + r + "," + g + "," + b + ")";
      text.textContent = rgb;
      ctx.fillStyle = rgb;
      ctx.fillRect(0, 0, canvas.width, canvas.height);
    }
  </script>
 </body>
</html>