clip-multiple-move-2.html (656B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <canvas id="canvas" width="150" height="150"></canvas> 5 6 <script> 7 8 var canvas = document.getElementById('canvas'); 9 var ctx = canvas.getContext('2d'); 10 11 ctx.fillStyle = '#f00'; 12 ctx.fillRect(0, 0, 150, 150); 13 14 ctx.beginPath(); 15 ctx.moveTo(0, 0); 16 ctx.moveTo(0, -1); 17 ctx.lineTo(0, 150); 18 ctx.lineTo(150, 150); 19 20 // The coordinate '149.99999' makes skia use GrConvexPolyEffect to handle the points. 21 // The result should be same as '150'. So this test checks if the GrConvexPolyEffect 22 // works well. 23 ctx.lineTo(149.99999, -1); 24 25 ctx.closePath(); 26 ctx.clip(); 27 28 ctx.fillStyle = '#0f0'; 29 ctx.fillRect(0, 0, 150, 150); 30 31 </script> 32 </body></html>