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.)
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE html> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <meta charset="utf-8"> |
michael@0 | 10 | <title>WebGL Scissor Test</title> |
michael@0 | 11 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 12 | <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script> |
michael@0 | 13 | <script src="../../debug/webgl-debug.js"></script> |
michael@0 | 14 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 15 | <script src="../resources/webgl-test-utils.js"></script> |
michael@0 | 16 | </head> |
michael@0 | 17 | <body> |
michael@0 | 18 | <div id="description"></div> |
michael@0 | 19 | <div id="console"></div> |
michael@0 | 20 | <canvas id="canvas" width="2" height="2" style="width: 40px; height: 40px;"> </canvas> |
michael@0 | 21 | <script> |
michael@0 | 22 | description("Check if glScissor setting works."); |
michael@0 | 23 | |
michael@0 | 24 | debug(""); |
michael@0 | 25 | debug("Canvas.getContext"); |
michael@0 | 26 | |
michael@0 | 27 | var wtu = WebGLTestUtils; |
michael@0 | 28 | var gl = wtu.create3DContext(document.getElementById("canvas")); |
michael@0 | 29 | if (!gl) { |
michael@0 | 30 | testFailed("context does not exist"); |
michael@0 | 31 | } else { |
michael@0 | 32 | testPassed("context exists"); |
michael@0 | 33 | |
michael@0 | 34 | debug(""); |
michael@0 | 35 | |
michael@0 | 36 | gl.clearColor(0,0,0,0); |
michael@0 | 37 | gl.clear(gl.COLOR_BUFFER_BIT); |
michael@0 | 38 | |
michael@0 | 39 | // clear a portion of our FBO |
michael@0 | 40 | gl.enable(gl.SCISSOR_TEST); |
michael@0 | 41 | gl.scissor(0, 0, 1, 1); |
michael@0 | 42 | gl.clearColor(0,1,0,1); |
michael@0 | 43 | gl.clear(gl.COLOR_BUFFER_BIT); |
michael@0 | 44 | |
michael@0 | 45 | var b = new Uint8Array(2 * 2 * 4); |
michael@0 | 46 | gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, b); |
michael@0 | 47 | |
michael@0 | 48 | function checkPixel(b, x, y, color) { |
michael@0 | 49 | var offset = (y * 2 + x) * 4; |
michael@0 | 50 | var match = true; |
michael@0 | 51 | for (var c = 0; c < 4; ++c) { |
michael@0 | 52 | if (b[offset + c] != color[c] * 255) { |
michael@0 | 53 | match = false; |
michael@0 | 54 | break; |
michael@0 | 55 | } |
michael@0 | 56 | } |
michael@0 | 57 | assertMsg(match, "pixel at " + x + ", " + y + " is expected value"); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | checkPixel(b, 0, 0, [0, 1, 0, 1]); |
michael@0 | 61 | checkPixel(b, 1, 0, [0, 0, 0, 0]); |
michael@0 | 62 | checkPixel(b, 0, 1, [0, 0, 0, 0]); |
michael@0 | 63 | checkPixel(b, 1, 1, [0, 0, 0, 0]); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | debug(""); |
michael@0 | 67 | successfullyParsed = true; |
michael@0 | 68 | |
michael@0 | 69 | </script> |
michael@0 | 70 | <script>finishTest();</script> |
michael@0 | 71 | |
michael@0 | 72 | </body> |
michael@0 | 73 | </html> |