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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-in-worker.html

Issue 1928043002: Add drawImage() originClean() getSecurityOrigin() to OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drawImage API added to interface listing Created 4 years, 7 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <canvas id='output' width='150' height='150'></canvas> 4 <canvas id='output' width='150' height='150'></canvas>
5 <script id='myWorker' type='text/worker'> 5 <script id='myWorker' type='text/worker'>
6 self.onmessage = function(e) { 6 self.onmessage = function(e) {
7 var aCanvas = new OffscreenCanvas(150, 150); 7 var aCanvas = new OffscreenCanvas(150, 150);
8 var ctx = aCanvas.getContext('2d'); 8 var ctx = aCanvas.getContext('2d');
9 9
10 var myPattern = ctx.createPattern(e.data, 'repeat'); 10 ctx.drawImage(e.data, 0, 0);
11 ctx.fillStyle = myPattern; 11 ctx.drawImage(e.data, 30, 30);
12 ctx.fillRect(0, 0, aCanvas.width, aCanvas.height); 12 // stretch the image
13 ctx.drawImage(e.data, 8, 8, 15, 15, 60, 60, 60, 60);
14 // reduce the image
15 ctx.drawImage(e.data, 8, 8, 15, 15, 120, 120, 15, 15);
13 16
14 var image = aCanvas.transferToImageBitmap(); 17 var image = aCanvas.transferToImageBitmap();
15 self.postMessage(image, [image]); 18 self.postMessage(image, [image]);
16 }; 19 };
17 </script> 20 </script>
18 <script> 21 <script>
19 if (window.testRunner) { 22 if (window.testRunner) {
20 testRunner.waitUntilDone(); 23 testRunner.waitUntilDone();
21 } 24 }
22 25
(...skipping 19 matching lines...) Expand all
42 outputCtx.transferFromImageBitmap(msg.data); 45 outputCtx.transferFromImageBitmap(msg.data);
43 if (window.testRunner) { 46 if (window.testRunner) {
44 testRunner.notifyDone(); 47 testRunner.notifyDone();
45 } 48 }
46 }); 49 });
47 worker.postMessage(patternImage, [patternImage]); 50 worker.postMessage(patternImage, [patternImage]);
48 } 51 }
49 </script> 52 </script>
50 </body> 53 </body>
51 54
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698