• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html>
3<body>
4This is a test should draw a fine filtered checkerboard pattern with no flickering. <br>
5This is a regression test for https://bugs.webkit.org/show_bug.cgi?id=64321. <br>
6<canvas id="c" width="300" height="300" style="width : 600px; height : 600px"></canvas>
7<script type="text/javascript">
8var canvas = document.getElementById('c');
9var ctx = canvas.getContext('2d');
10
11for (var x = 0; x < canvas.width; x++) {
12    for (var y = 0; y < canvas.height; y++) {
13        ctx.fillStyle = ((x + y) % 2) ? 'black' : 'white';
14        ctx.fillRect(x, y, 1, 1);
15    }
16}
17
18var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
19
20function draw() {
21    ctx.putImageData(imageData, 0, 0);
22    window.setTimeout(draw, 0);
23}
24
25draw();
26</script>
27</body>
28</html>
29