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

Side by Side Diff: content/test/data/gpu/pixel_offscreenCanvas_2d_resize_on_worker.html

Issue 2588053003: Make OffscreenCanvas resizable (Closed)
Patch Set: rebase Created 3 years, 12 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
« no previous file with comments | « no previous file | content/test/data/gpu/pixel_offscreenCanvas_webgl_resize_on_worker.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2
3 <!-- READ BEFORE UPDATING:
4 If this test is updated make sure to increment the "revision" value of the
5 associated test in content/test/gpu/gpu_tests/pixel_test_pages.py. This will ens ure
6 that the baseline images are regenerated on the next run.
7 -->
8
9 <html>
10 <head>
11 <title>OffscreenCanvas2d.commit with resizing: red rectangle in the middle.</tit le>
12 <style type="text/css">
13 .nomargin {
14 margin: 0px auto;
15 }
16 </style>
17 <script id="myWorker" type="text/worker">
18 self.onmessage = function(e) {
19 var transfered = e.data;
20
21 // Resize offscreenCanvas from 200X200 to 40X50.
22 transfered.width = 40;
23 transfered.height = 50;
24 var ctx2d = transfered.getContext('2d');
25
26 // The resultant image should be 100X80 red-color rectangle in the middle
27 // of green background.
28 ctx2d.fillStyle = "green";
29 ctx2d.fillRect(0, 0, transfered.width, transfered.height);
30 ctx2d.fillStyle = "red";
31 ctx2d.fillRect(10, 10, 20, 20);
32 ctx2d.commit();
33
34 self.postMessage("");
35 };
36 </script>
37 <script>
38 var g_swapsBeforeAck = 15;
39
40 function makeWorker(script)
41 {
42 var blob = new Blob([script]);
43 return new Worker(URL.createObjectURL(blob));
44 }
45
46 function waitForFinish()
47 {
48 if (g_swapsBeforeAck == 0) {
49 domAutomationController.setAutomationId(1);
50 domAutomationController.send("SUCCESS");
51 } else {
52 g_swapsBeforeAck--;
53 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1;
54 window.webkitRequestAnimationFrame(waitForFinish);
55 }
56 }
57
58 function main()
59 {
60 var canvas2D = document.getElementById("c");
61 var offscreenCanvas = canvas2D.transferControlToOffscreen();
62 var worker = makeWorker(document.getElementById("myWorker").textContent);
63 worker.onmessage = function (e) {
64 waitForFinish();
65 };
66 worker.postMessage(offscreenCanvas, [offscreenCanvas]);
67 }
68 </script>
69 </head>
70 <body onload="main()">
71 <div style="position:relative; width:200px; height:200px; background-color:white ">
72 </div>
73 <div id="container" style="position:absolute; top:0px; left:0px">
74 <canvas id="c" width="200" height="200" class="nomargin"></canvas>
75 </div>
76 </body>
77 </html>
OLDNEW
« no previous file with comments | « no previous file | content/test/data/gpu/pixel_offscreenCanvas_webgl_resize_on_worker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698