tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

1972885-ref.html (748B)


      1 <!DOCTYPE html>
      2 <html>
      3 <meta charset="utf-8">
      4 <title>Reference for Bug 1972885</title>
      5 <style>
      6 body {
      7  margin: 0;
      8 }
      9 canvas {
     10  /* Rounded up. */
     11  margin-top: 2px;
     12  width: 100px;
     13  /* Subpixel snapped down. */
     14  height: 100px;
     15 }
     16 </style>
     17 <canvas id="canvas"></canvas>
     18 <script>
     19 function draw(canvas, width, height) {
     20  const ctx = canvas.getContext('2d');
     21  canvas.width = width;
     22  canvas.height = height;
     23  const imgData = ctx.createImageData(width, height);
     24  const u32View = new Uint32Array(imgData.data.buffer);
     25  u32View.fill(0xFFFFFFFF);
     26  for (let y = 0; y < height; y += 2) {
     27    for (let x = 0; x < width; x++) {
     28      u32View[y * width + x] = 0xFF000000;
     29    }
     30  }
     31  ctx.putImageData(imgData, 0, 0);
     32 }
     33 
     34 draw(canvas, 100, 100);
     35 </script>