| OLD | NEW |
| 1 function checkCanvasRect(buf, x, y, width, height, color, tolerance, bufWidth, r
etVal) | 1 function checkCanvasRect(buf, x, y, width, height, color, tolerance, bufWidth, r
etVal) |
| 2 { | 2 { |
| 3 for (var px = x; px < x + width; px++) { | 3 for (var px = x; px < x + width; px++) { |
| 4 for (var py = y; py < y + height; py++) { | 4 for (var py = y; py < y + height; py++) { |
| 5 var offset = (py * bufWidth + px) * 4; | 5 var offset = (py * bufWidth + px) * 4; |
| 6 for (var j = 0; j < color.length; j++) { | 6 for (var j = 0; j < color.length; j++) { |
| 7 if (Math.abs(buf[offset + j] - color[j]) > tolerance) { | 7 if (Math.abs(buf[offset + j] - color[j]) > tolerance) { |
| 8 retVal.testPassed = false; | 8 retVal.testPassed = false; |
| 9 return; | 9 return; |
| 10 } | 10 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 var halfWidth = Math.floor(width / 2); | 50 var halfWidth = Math.floor(width / 2); |
| 51 var quaterWidth = Math.floor(halfWidth / 2); | 51 var quaterWidth = Math.floor(halfWidth / 2); |
| 52 var height = gl.canvas.height; | 52 var height = gl.canvas.height; |
| 53 var halfHeight = Math.floor(height / 2); | 53 var halfHeight = Math.floor(height / 2); |
| 54 var quaterHeight = Math.floor(halfHeight / 2); | 54 var quaterHeight = Math.floor(halfHeight / 2); |
| 55 | 55 |
| 56 var top = flipY ? quaterHeight : (height - halfHeight + quaterHeight); | 56 var top = flipY ? quaterHeight : (height - halfHeight + quaterHeight); |
| 57 var bottom = flipY ? (height - halfHeight + quaterHeight) : quaterHeight; | 57 var bottom = flipY ? (height - halfHeight + quaterHeight) : quaterHeight; |
| 58 | 58 |
| 59 var tl = redColor; | 59 var tl = redColor; |
| 60 var tr = premultiplyAlpha ? ((retVal.alpha == 0.5) ? halfRed : (retVal.alpha
== 1) ? redColor : blackColor) : redColor; | 60 var tr = premultiplyAlpha ? ((retVal.alpha == 0.5) ? darkRed : (retVal.alpha
== 1) ? redColor : blackColor) : redColor; |
| 61 var bl = greenColor; | 61 var bl = greenColor; |
| 62 var br = premultiplyAlpha ? ((retVal.alpha == 0.5) ? halfGreen : (retVal.alp
ha == 1) ? greenColor : blackColor) : greenColor; | 62 var br = premultiplyAlpha ? ((retVal.alpha == 0.5) ? darkGreen : (retVal.alp
ha == 1) ? greenColor : blackColor) : greenColor; |
| 63 | 63 |
| 64 var blueColor = [0, 0, 255]; | 64 var blueColor = [0, 0, 255]; |
| 65 if (colorspace == 'none') { | 65 if (colorspace == 'none') { |
| 66 tl = tr = bl = br = blueColor; | 66 tl = tr = bl = br = blueColor; |
| 67 } else if (colorspace == 'default' || colorspace == 'notprovided') { | 67 } else if (colorspace == 'default' || colorspace == 'notprovided') { |
| 68 tl = tr = bl = br = redColor; | 68 tl = tr = bl = br = redColor; |
| 69 } | 69 } |
| 70 | 70 |
| 71 var loc; | 71 var loc; |
| 72 if (bindingTarget == gl.TEXTURE_CUBE_MAP) { | 72 if (bindingTarget == gl.TEXTURE_CUBE_MAP) { |
| 73 loc = gl.getUniformLocation(program, "face"); | 73 loc = gl.getUniformLocation(program, "face"); |
| 74 } | 74 } |
| 75 | 75 |
| 76 var tolerance = (retVal.alpha == 0) ? 0 : 3; | 76 var tolerance = (retVal.alpha == 0) ? 0 : 2; |
| 77 if (colorspace == 'default' || colorspace == 'none' || colorspace == 'notpro
vided') | 77 if (colorspace == 'default' || colorspace == 'none' || colorspace == 'notpro
vided') |
| 78 tolerance = 13; // For linux and win, the tolerance can be 8. | 78 tolerance = 13; // For linux and win, the tolerance can be 8. |
| 79 for (var tt = 0; tt < targets.length; ++tt) { | 79 for (var tt = 0; tt < targets.length; ++tt) { |
| 80 if (bindingTarget == gl.TEXTURE_CUBE_MAP) { | 80 if (bindingTarget == gl.TEXTURE_CUBE_MAP) { |
| 81 gl.uniform1i(loc, targets[tt]); | 81 gl.uniform1i(loc, targets[tt]); |
| 82 } | 82 } |
| 83 // Draw the triangles | 83 // Draw the triangles |
| 84 gl.clearColor(0, 0, 0, 1); | 84 gl.clearColor(0, 0, 0, 1); |
| 85 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | 85 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
| 86 gl.drawArrays(gl.TRIANGLES, 0, 6); | 86 gl.drawArrays(gl.TRIANGLES, 0, 6); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 function runTest(bitmaps, alphaVal, colorspaceEffective) | 129 function runTest(bitmaps, alphaVal, colorspaceEffective) |
| 130 { | 130 { |
| 131 var retVal = {testPassed: true, alpha: alphaVal, colorspaceEffect: colorspac
eEffective}; | 131 var retVal = {testPassed: true, alpha: alphaVal, colorspaceEffect: colorspac
eEffective}; |
| 132 var program = tiu.setupTexturedQuad(gl, internalFormat); | 132 var program = tiu.setupTexturedQuad(gl, internalFormat); |
| 133 runTestOnBindingTarget(gl.TEXTURE_2D, program, bitmaps, retVal); | 133 runTestOnBindingTarget(gl.TEXTURE_2D, program, bitmaps, retVal); |
| 134 program = tiu.setupTexturedQuadWithCubeMap(gl, internalFormat); | 134 program = tiu.setupTexturedQuadWithCubeMap(gl, internalFormat); |
| 135 runTestOnBindingTarget(gl.TEXTURE_CUBE_MAP, program, bitmaps, retVal); | 135 runTestOnBindingTarget(gl.TEXTURE_CUBE_MAP, program, bitmaps, retVal); |
| 136 return retVal.testPassed; | 136 return retVal.testPassed; |
| 137 } | 137 } |
| OLD | NEW |