Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-image-bitmap-utils.js

Issue 1809603004: Use ImageDecoder for createImageBitmap(HTMLImageElement, premultiplyAlpha=false) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase done Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698