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

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

Issue 1806943005: Implemented/Tested line-drawing functions in OffscreenCanvas 2D Context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits + rebase with master Created 4 years, 9 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 <!DOCTYPE html>
2 <html>
3 <body>
4 <canvas id='output' width='200' height='400'></canvas>
5 <script id='myWorker' type='text/worker'>
6 self.onmessage = function(e) {
7 var aCanvas = new OffscreenCanvas(200, 400);
8 var ctx = aCanvas.getContext('2d');
9
10 ctx.beginPath();
11 ctx.lineWidth = '10';
12 ctx.strokeStyle = 'green';
13 ctx.lineJoin = 'round';
14 ctx.moveTo(15, 15);
15 ctx.lineTo(135, 15);
16 ctx.lineTo(70, 170);
17 ctx.closePath();
18 ctx.stroke();
19
20 var path1 = new Path2D();
21 path1.moveTo(150, 25);
22 path1.bezierCurveTo(10, 150, 10, 300, 100, 200);
23 ctx.strokeStyle = 'purple';
24 ctx.setLineDash([ 10, 5 ]);
25 ctx.stroke(path1);
26
27 ctx.fillStyle = 'red';
28 ctx.beginPath()
29 ctx.arc(75, 325, 50, 0, Math.PI * 2, true);
30 ctx.arc(75, 325, 20, 0, Math.PI * 2, true);
31 ctx.fill("evenodd");
32
33 var image = aCanvas.transferToImageBitmap();
34 self.postMessage(image, [image]);
35 };
36 </script>
37 <script>
38 if (window.testRunner) {
39 testRunner.waitUntilDone();
40 }
41 var blob = new Blob([document.getElementById('myWorker').textContent]);
42 var worker = new Worker(URL.createObjectURL(blob));
43 worker.addEventListener('message', msg => {
44 var outputCtx = document.getElementById('output').getContext('imagebitmap');
45 outputCtx.transferImageBitmap(msg.data);
46 if (window.testRunner) {
47 testRunner.notifyDone();
48 }
49 });
50 worker.postMessage("");
51 </script>
52 </body>
53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698