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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html
diff --git a/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html b/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html
new file mode 100644
index 0000000000000000000000000000000000000000..7bd7134ac5a8a4a96e68d0537ca04511435f6f14
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html
@@ -0,0 +1,40 @@
+<html>
+<body>
+<canvas id="c1" width="300" height="300"></canvas>
+<canvas id="c2" width="300" height="300"></canvas>
+<script type="text/javascript">
+var canvas1 = document.getElementById('c1');
+var canvas2 = document.getElementById('c2');
+var bgcanvas = document.createElement('canvas');
+bgcanvas.width = 100;
+bgcanvas.height = 100;
+var bgctx = bgcanvas.getContext('2d');
+bgctx.fillStyle = 'green';
+bgctx.fillRect(0, 0, bgcanvas.width, bgcanvas.height);
+var img = new Image();
+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
+var ctx1 = canvas1.getContext('2d');
+var ctx2 = canvas2.getContext('2d');
+
+ctx1.drawImage(bgcanvas, -100, -100, 300, 300, 0, 0, 300, 300);
+ctx1.drawImage(bgcanvas, -100, -100, 200, 200, 0, 0, 100, 100);
+ctx1.drawImage(bgcanvas, 0, -100, 100, 200, 100, 0, 100, 100);
+ctx1.drawImage(bgcanvas, 0, -100, 200, 200, 200, 0, 100, 100);
+ctx1.drawImage(bgcanvas, -100, 0, 200, 100, 0, 100, 100, 100);
+ctx1.drawImage(bgcanvas, 0, 0, 200, 100, 200, 100, 100, 100);
+ctx1.drawImage(bgcanvas, -100, 0, 200, 200, 0, 200, 100, 100);
+ctx1.drawImage(bgcanvas, 0, 0, 100, 200, 100, 200, 100, 100);
+ctx1.drawImage(bgcanvas, 0, 0, 200, 200, 200, 200, 100, 100);
+
+ctx2.drawImage(bgcanvas, -100, -100, 300, 300, 0, 0, 300, 300);
+ctx2.drawImage(bgcanvas, -100, -100, 200, 200, 0, 0, 100, 100);
+ctx2.drawImage(bgcanvas, 0, -100, 100, 200, 100, 0, 100, 100);
+ctx2.drawImage(bgcanvas, 0, -100, 200, 200, 200, 0, 100, 100);
+ctx2.drawImage(bgcanvas, -100, 0, 200, 100, 0, 100, 100, 100);
+ctx2.drawImage(bgcanvas, 0, 0, 200, 100, 200, 100, 100, 100);
+ctx2.drawImage(bgcanvas, -100, 0, 200, 200, 0, 200, 100, 100);
+ctx2.drawImage(bgcanvas, 0, 0, 100, 200, 100, 200, 100, 100);
+ctx2.drawImage(bgcanvas, 0, 0, 200, 200, 200, 200, 100, 100);
+
+</script>
+</body></html>

Powered by Google App Engine
This is Rietveld 408576698