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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-webgl-preserveDrawingBuffer.html

Issue 2627793003: Make OffscreenCanvas Webgl Context work with preserveDrawingBuffer flag (Closed)
Patch Set: fix based on reviewer feedback Created 3 years, 11 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 | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h » ('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 <script src="../../resources/testharness.js"></script>
2 <script src="../../resources/testharnessreport.js"></script>
3 <script>
4
5 function getPixelsFromOffscreenWebgl(preserveFlag) {
6 var canvas = document.createElement("canvas");
7 var offscreenCanvas = canvas.transferControlToOffscreen();
8 var gl = offscreenCanvas.getContext("webgl", {preserveDrawingBuffer: preserveF lag});
9
10 // Draw some color on gl and commit
11 gl.clearColor(1, 0, 1, 1);
12 gl.clear(gl.COLOR_BUFFER_BIT);
13 gl.commit();
14
15 var pixels = new Uint8Array(50 * 50 * 4);
16 gl.readPixels(0, 0, 50, 50, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
17 return pixels;
18 }
19
20 test(function() {
21 var pixelsPreserve = getPixelsFromOffscreenWebgl(true);
22 assert_equals(pixelsPreserve[0], 255);
23 assert_equals(pixelsPreserve[1], 0);
24 assert_equals(pixelsPreserve[2], 255);
25 assert_equals(pixelsPreserve[3], 255);
26 }, "test if OffscreenCanvas.webgl retains context if preserveDrawingBuffer is tr ue.");
27
28 test(function() {
29 var pixelsNoPreserve = getPixelsFromOffscreenWebgl(false);
30 assert_equals(pixelsNoPreserve[0], 0);
31 assert_equals(pixelsNoPreserve[1], 0);
32 assert_equals(pixelsNoPreserve[2], 0);
33 assert_equals(pixelsNoPreserve[3], 0);
34 }, "test if OffscreenCanvas.webgl loses context if presereDrawingbuffer is false .");
35 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698