Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js b/third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js |
| index fe6e8842e2f8bad506e8ab8a6dacab61e9a91a39..0cd0fbbbe5ee80b0825660eec5f2cb4b5c0d6de6 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js |
| @@ -13,7 +13,7 @@ function checkCanvasRect(buf, x, y, width, height, color, tolerance, bufWidth, r |
| } |
| } |
| -function runOneIteration(useTexSubImage2D, bindingTarget, program, bitmap, flipY, premultiplyAlpha, retVal) |
| +function runOneIteration(useTexSubImage2D, bindingTarget, program, bitmap, flipY, premultiplyAlpha, retVal, colorspace = 'empty') |
| { |
| gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
| // Enable writes to the RGBA channels |
| @@ -61,12 +61,21 @@ function runOneIteration(useTexSubImage2D, bindingTarget, program, bitmap, flipY |
| var bl = greenColor; |
| var br = premultiplyAlpha ? ((retVal.alpha == 0.5) ? halfGreen : (retVal.alpha == 1) ? greenColor : blackColor) : greenColor; |
| + var blueColor = [0, 0, 255]; |
| + if (colorspace == 'none') { |
| + tl = tr = bl = br = blueColor; |
| + } else if (colorspace == 'default') { |
| + tl = tr = bl = br = redColor; |
| + } |
| + |
| var loc; |
| if (bindingTarget == gl.TEXTURE_CUBE_MAP) { |
| loc = gl.getUniformLocation(program, "face"); |
| } |
| var tolerance = (retVal.alpha == 0) ? 0 : 3; |
| + if (colorspace == 'default' || colorspace == 'none') |
| + tolerance = 8; |
| for (var tt = 0; tt < targets.length; ++tt) { |
| if (bindingTarget == gl.TEXTURE_CUBE_MAP) { |
| gl.uniform1i(loc, targets[tt]); |
| @@ -101,15 +110,24 @@ function runTestOnBindingTarget(bindingTarget, program, bitmaps, retVal) { |
| runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.flipYPremul, true, true, retVal); |
| runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.flipYDefault, true, true, retVal); |
| runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.flipYUnpremul, true, false, retVal); |
| + if (retVal.colorspaceEffect) { |
| + runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.colorspaceDef, false, true, retVal, 'default'); |
| + runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.colorspaceNone, false, true, retVal, 'none'); |
| + runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.colorspaceDefault, false, true, retVal, 'default'); |
|
Justin Novosad
2016/03/09 16:29:39
What is the difference between colorspaceDef and c
xidachen
2016/03/14 13:29:41
colorspaceDef is created with out given any colors
|
| + } else { |
| + runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.colorspaceDef, false, true, retVal); |
|
Justin Novosad
2016/03/09 16:29:39
How is this different from the line with bitmaps.d
xidachen
2016/03/14 13:29:41
bitmaps.colorspaceDef is created with a png that h
|
| + runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.colorspaceNone, false, true, retVal); |
| + runOneIteration(cases[i].sub, bindingTarget, program, bitmaps.colorspaceDefault, false, true, retVal); |
| + } |
| } |
| } |
| -function runTest(bitmaps, alphaVal) |
| +function runTest(bitmaps, alphaVal, colorspaceEffective) |
| { |
| - var retVal = {testPassed: true, alpha: alphaVal}; |
| + var retVal = {testPassed: true, alpha: alphaVal, colorspaceEffect: colorspaceEffective}; |
| var program = tiu.setupTexturedQuad(gl, internalFormat); |
| runTestOnBindingTarget(gl.TEXTURE_2D, program, bitmaps, retVal); |
| -// program = tiu.setupTexturedQuadWithCubeMap(gl, internalFormat); |
| -// runTestOnBindingTarget(gl.TEXTURE_CUBE_MAP, program, bitmaps, retVal); |
| + program = tiu.setupTexturedQuadWithCubeMap(gl, internalFormat); |
| + runTestOnBindingTarget(gl.TEXTURE_CUBE_MAP, program, bitmaps, retVal); |
| return retVal.testPassed; |
| } |