tor-browser

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

2d.layer.non-invertible-matrix.shadow.html (1437B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <link rel="match" href="2d.layer.non-invertible-matrix.shadow-expected.html">
      5 <title>Canvas test: 2d.layer.non-invertible-matrix.shadow</title>
      6 <h1>2d.layer.non-invertible-matrix.shadow</h1>
      7 <p class="desc">Test drawing layers when the transform is not invertible.</p>
      8 <canvas id="canvas" width="200" height="200">
      9  <p class="fallback">FAIL (fallback content)</p>
     10 </canvas>
     11 <script>
     12  const canvas = document.getElementById("canvas");
     13  const ctx = canvas.getContext('2d');
     14 
     15  ctx.fillStyle = 'blue';
     16  ctx.fillRect(30, 30, 50, 50);
     17 
     18  // Anything below will be non-rasterizable.
     19  ctx.scale(1, 0);
     20 
     21  ctx.shadowOffsetX = 0;
     22  ctx.shadowOffsetY = 20;
     23  ctx.shadowColor = 'rgba(255, 165, 0, 0.6)';
     24 
     25  // Open the layer with a non-invertible matrix. The whole layer will be
     26  // non-rasterizable.
     27  ctx.beginLayer();
     28 
     29  // Because the transform is global, the matrix is still non-invertible.
     30  ctx.fillStyle = 'rgba(225, 0, 0, 1)';
     31  ctx.fillRect(40, 70, 50, 50);
     32 
     33  // Set a valid matrix in the middle of the layer. This makes the global
     34  // matrix invertible again, but because because the layer was opened with a
     35  // non-invertible matrix, the whole layer remains non-rasterizable.
     36  ctx.setTransform(1, 0, 0, 1, 0, 0);
     37 
     38  ctx.fillStyle = 'green';
     39  ctx.fillRect(70, 40, 50, 50);
     40 
     41  ctx.endLayer();
     42 </script>