Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html

Issue 19267027: Fixing src rectangle clipping with drawImage (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: renamed clipRectsToImage to clipRectsToImageRect Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <body>
3 <canvas id="c1" width="300" height="300"></canvas>
4 <canvas id="c2" width="300" height="300"></canvas>
5 <script type="text/javascript">
6 var canvas1 = document.getElementById('c1');
7 var canvas2 = document.getElementById('c2');
8 var bgcanvas = document.createElement('canvas');
9 bgcanvas.width = 100;
10 bgcanvas.height = 100;
11 var bgctx = bgcanvas.getContext('2d');
12 bgctx.fillStyle = 'green';
13 bgctx.fillRect(0, 0, bgcanvas.width, bgcanvas.height);
14 var img = new Image();
15 img.src = bgcanvas.toDataURL();
Stephen White 2013/07/22 22:02:06 Looks like you create this image, but don't do any
Justin Novosad 2013/07/23 17:38:34 Done. 'img' was for the second block of tests (cop
16 var ctx1 = canvas1.getContext('2d');
17 var ctx2 = canvas2.getContext('2d');
18
19 ctx1.drawImage(bgcanvas, -100, -100, 300, 300, 0, 0, 300, 300);
20 ctx1.drawImage(bgcanvas, -100, -100, 200, 200, 0, 0, 100, 100);
21 ctx1.drawImage(bgcanvas, 0, -100, 100, 200, 100, 0, 100, 100);
22 ctx1.drawImage(bgcanvas, 0, -100, 200, 200, 200, 0, 100, 100);
23 ctx1.drawImage(bgcanvas, -100, 0, 200, 100, 0, 100, 100, 100);
24 ctx1.drawImage(bgcanvas, 0, 0, 200, 100, 200, 100, 100, 100);
25 ctx1.drawImage(bgcanvas, -100, 0, 200, 200, 0, 200, 100, 100);
26 ctx1.drawImage(bgcanvas, 0, 0, 100, 200, 100, 200, 100, 100);
27 ctx1.drawImage(bgcanvas, 0, 0, 200, 200, 200, 200, 100, 100);
28
29 ctx2.drawImage(bgcanvas, -100, -100, 300, 300, 0, 0, 300, 300);
30 ctx2.drawImage(bgcanvas, -100, -100, 200, 200, 0, 0, 100, 100);
31 ctx2.drawImage(bgcanvas, 0, -100, 100, 200, 100, 0, 100, 100);
32 ctx2.drawImage(bgcanvas, 0, -100, 200, 200, 200, 0, 100, 100);
33 ctx2.drawImage(bgcanvas, -100, 0, 200, 100, 0, 100, 100, 100);
34 ctx2.drawImage(bgcanvas, 0, 0, 200, 100, 200, 100, 100, 100);
35 ctx2.drawImage(bgcanvas, -100, 0, 200, 200, 0, 200, 100, 100);
36 ctx2.drawImage(bgcanvas, 0, 0, 100, 200, 100, 200, 100, 100);
37 ctx2.drawImage(bgcanvas, 0, 0, 200, 200, 200, 200, 100, 100);
38
39 </script>
40 </body></html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698