Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / draw-webgl-to-canvas-2d.html
blob3b90d53d0df71fb3f9d35600819568fadadd0fb1
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <span id="description" style="color: white">
5 This test checks for drawing webgl to canvas 2d. The test process is as follows:
6 1. draw a green rect on a webgl context.
7 2. draw a red rect on a canvas 2d context, and check a pixel (should be red).
8 3. draw the webgl contents on the canvas 2d context, and check a pixel (should be green).
9 4. wait for few frames.
10 5. draw a red rect on the canvas 2d context, and check a pixel (should be red).
11 6. draw the webgl contents on the canvas 2d context, and check a pixel (see below explanation).
13 Above test is executed for both preserve and non-preserve webgl contexts.
14 For the preserve webgl context, the pixel on #6 is green.
15 For the non-preserve webgl context, the pixel on #6 is undefined.[1]
17 [1] http://www.khronos.org/registry/webgl/specs/latest/1.0/.
18 "This default behavior can be changed by setting the preserveDrawingBuffer
19 attribute of the WebGLContextAttributes object. If this flag is true, the
20 contents of the drawing buffer shall be preserved until the author either clears
21 or overwrites them. If this flag is false, attempting to perform operations
22 using this context as a source image after the rendering function has returned
23 can lead to undefined behavior.".
24 </span>
25 <canvas id="preserve-canvas3d" width="100" height="100"></canvas>
26 <canvas id="preserve-canvas2d" width="100" height="100"></canvas>
27 <canvas id="nonpreserve-canvas3d" width="100" height="100"></canvas>
28 <canvas id="nonpreserve-canvas2d" width="100" height="100"></canvas>
29 <script src="../../../resources/js-test.js"></script>
30 <script src="resources/draw-webgl-to-canvas-2d.js"></script>
31 <script>
32 function createContexts() {
33 preserve_ctx2D = document.getElementById("preserve-canvas2d").getContext("2d");
34 preserve_canvas3D = document.getElementById('preserve-canvas3d');
35 preserve_gl = preserve_canvas3D.getContext('webgl', {'preserveDrawingBuffer': true});
36 nonpreserve_ctx2D = document.getElementById("nonpreserve-canvas2d").getContext("2d");
37 nonpreserve_canvas3D = document.getElementById('nonpreserve-canvas3d');
38 nonpreserve_gl = nonpreserve_canvas3D.getContext('webgl', {'preserveDrawingBuffer': false});
40 </script>
41 </body>
42 </html>