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

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

Issue 2588053003: Make OffscreenCanvas resizable (Closed)
Patch Set: fix Created 4 years 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>
Ken Russell (switch to Gerrit) 2016/12/20 06:01:24 Similar comment: ...resize_on_worker?
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/page_sets/pixel_tests.py. This will ensure
Ken Russell (switch to Gerrit) 2016/12/20 06:01:24 Same fix here.
6 that the baseline images are regenerated on the next run.
7 -->
8
9 <html>
10 <head>
11 <title>OffscreenCanvas 2d commit flow with resizing: 100X200 canvas as a result. </title>
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 var gl = transfered.getContext('webgl');
21 gl.clearColor(0, 1, 0, 1);
22 gl.clear(gl.COLOR_BUFFER_BIT);
23 gl.commit();
24
25 // Resize offscreenCanvas from 150X150 to 100X200.
26 transfered.width = 100;
27 transfered.height = 200;
28 gl.clearColor(0, 0, 1, 1);
29 gl.clear(gl.COLOR_BUFFER_BIT);
30 gl.commit();
31
32 self.postMessage("");
33 };
34 </script>
35 <script>
36 var g_swapsBeforeAck = 15;
37
38 function makeWorker(script)
39 {
40 var blob = new Blob([script]);
41 return new Worker(URL.createObjectURL(blob));
42 }
43
44 function waitForFinish()
45 {
46 if (g_swapsBeforeAck == 0) {
47 domAutomationController.setAutomationId(1);
48 domAutomationController.send("SUCCESS");
49 } else {
50 g_swapsBeforeAck--;
51 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1;
52 window.webkitRequestAnimationFrame(waitForFinish);
53 }
54 }
55
56 function main()
57 {
58 var canvas2D = document.getElementById("c");
59 var offscreenCanvas = canvas2D.transferControlToOffscreen();
60 var worker = makeWorker(document.getElementById("myWorker").textContent);
61 worker.postMessage(offscreenCanvas, [offscreenCanvas]);
62 worker.onmessage = function (e) {
Ken Russell (switch to Gerrit) 2016/12/20 06:01:24 Same race question here.
63 waitForFinish();
64 };
65 }
66 </script>
67 </head>
68 <body onload="main()">
69 <div style="position:relative; width:200px; height:200px; background-color:white ">
70 </div>
71 <div id="container" style="position:absolute; top:0px; left:0px">
72 <canvas id="c" width="150" height="150" class="nomargin"></canvas>
73 </div>
74 </body>
75 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698