Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 <!DOCTYPE html>
2 <html class="reftest-wait">
3 <head>
4 <meta charset="UTF-8">
6 <script type="text/javascript" src="webgl-utils.js"></script>
7 <script type="text/javascript">
8 /* Color-Alpha Test
9 *
10 * Clear the four quadrants of the canvas as follows:
11 * +------+------+
12 * | red |green |
13 * | | |
14 * +------+------+
15 * | blue |white |
16 * | | |
17 * +------+------+
18 * However, unlike the Color test, clear with a given alpha value.
19 * What effect this has depends on the context-creation args passed
20 * to this page.
21 *
22 * Here we check that we handle various combinations of alpha and
23 * premultipliedAlpha correctly.
24 */
26 "use strict";
28 function renderGL(gl, value, alpha) {
29 gl.enable(gl.SCISSOR_TEST);
31 gl.scissor(0, 128, 128, 128);
32 gl.clearColor(value, 0.0, 0.0, alpha);
33 gl.clear(gl.COLOR_BUFFER_BIT);
35 gl.scissor(128, 128, 128, 128);
36 gl.clearColor(0.0, value, 0.0, alpha);
37 gl.clear(gl.COLOR_BUFFER_BIT);
39 gl.scissor(0, 0, 128, 128);
40 gl.clearColor(0.0, 0.0, value, alpha);
41 gl.clear(gl.COLOR_BUFFER_BIT);
43 gl.scissor(128, 0, 128, 128);
44 gl.clearColor(value, value, value, alpha);
45 gl.clear(gl.COLOR_BUFFER_BIT);
47 gl.finish();
48 }
50 function renderFailure(canvas) {
51 // This will also trigger RAF for us.
52 var context = canvas.getContext("2d");
53 context.fillText('WebGL failed.', 64, 64);
54 }
56 function runTest() {
57 var canvas = document.getElementById("canvas");
58 var gl = initGL(canvas);
60 var value = arg("colorVal");
61 var alpha = arg("alphaVal");
63 if (gl)
64 renderGL(gl, value, alpha);
65 else
66 renderFailure(canvas);
68 waitForComposite(testComplete);
69 }
71 function testComplete() {
72 document.documentElement.removeAttribute("class");
73 }
74 </script>
75 </head>
77 <body onload="rAF(runTest);">
78 <canvas id="canvas" width="256" height="256"></canvas>
79 </body>
81 </html>