Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html |
| similarity index 77% |
| copy from third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap.html |
| copy to third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html |
| index 75928662546000748fd6bd6f340a3060b25af16e..0190d575083e7b8e3dd6d533fa0af74117a4ecc2 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap.html |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-image-bitmap-from-image-bitmap-from-canvas.html |
| @@ -18,8 +18,8 @@ var pixelType = "UNSIGNED_BYTE"; |
| var redColor = [255, 0, 0]; |
| var greenColor = [0, 255, 0]; |
| var blackColor = [0, 0, 0]; |
| -var halfRed = [128, 0, 0]; |
| -var halfGreen = [0, 128, 0]; |
| +var halfRed = [26, 0, 0]; |
|
Justin Novosad
2016/03/23 14:08:25
Not quite "half". perhaps call it "dim" or "dark".
xidachen
2016/03/23 15:51:36
Done.
|
| +var halfGreen = [0, 26, 0]; |
| function promiseRejected() |
| { |
| @@ -31,6 +31,23 @@ function pass() |
| document.getElementById("results").innerHTML = "Test <span style='color:green'>PASSED</span>"; |
| } |
| +function setCanvasToRedGreen(ctx) { |
| + ctx.canvas.width = 2; |
| + ctx.canvas.height = 2; |
| + var width = ctx.canvas.width; |
| + var halfWidth = Math.floor(width / 2); |
| + var height = ctx.canvas.height; |
| + var halfHeight = Math.floor(height / 2); |
| + ctx.fillStyle = "rgba(255, 0, 0, 1)"; |
| + ctx.fillRect(0, 0, halfWidth, halfHeight); |
| + ctx.fillStyle = "rgba(255, 0, 0, 0.1)"; |
| + ctx.fillRect(halfWidth, 0, halfWidth, halfHeight); |
| + ctx.fillStyle = "rgba(0, 255, 0, 1)"; |
| + ctx.fillRect(0, halfHeight, halfWidth, halfHeight); |
| + ctx.fillStyle = "rgba(0, 255, 0, 0.1)"; |
| + ctx.fillRect(halfWidth, halfHeight, halfWidth, halfHeight); |
| +} |
| + |
| function generateTest() |
| { |
| var bitmaps = []; |
| @@ -40,18 +57,14 @@ function generateTest() |
| gl.clearColor(0,0,0,1); |
| gl.clearDepth(1); |
| - gl.disable(gl.BLEND); |
| - var imageData = new ImageData(new Uint8ClampedArray( |
| - [255, 0, 0, 255, |
| - 255, 0, 0, 0, |
| - 0, 255, 0, 255, |
| - 0, 255, 0, 0]), |
| - 2, 2); |
| + var testCanvas = document.createElement('canvas'); |
| + var ctx = testCanvas.getContext("2d"); |
| + setCanvasToRedGreen(ctx); |
| var bitmap; // bitmap will be in unpremultiplied format |
| - createImageBitmap(imageData, {imageOrientation: "none", premultiplyAlpha: "none"}).then(function(image) { |
| - bitmap = image; |
| + createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "none"}).then(function(imageBitmap) { |
| + bitmap = imageBitmap; |
| var p1 = createImageBitmap(bitmap).then(function(imageBitmap) { bitmaps.defaultOption = imageBitmap }); |
| var p2 = createImageBitmap(bitmap, {imageOrientation: "none", premultiplyAlpha: "premultiply"}).then(function(imageBitmap) { bitmaps.noFlipYPremul = imageBitmap }); |
| var p3 = createImageBitmap(bitmap, {imageOrientation: "none", premultiplyAlpha: "default"}).then(function(imageBitmap) { bitmaps.noFlipYDefault = imageBitmap }); |
| @@ -63,7 +76,7 @@ function generateTest() |
| var p9 = createImageBitmap(bitmap, {colorspaceConversion: "none"}).then(function(imageBitmap) { bitmaps.colorspaceNone = imageBitmap }); |
| var p10 = createImageBitmap(bitmap, {colorspaceConversion: "default"}).then(function(imageBitmap) { bitmaps.colorspaceDefault = imageBitmap }); |
| Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9, p10]).then(function() { |
| - var alphaVal = 0; |
| + var alphaVal = 0.5; |
| var testPassed = runTest(bitmaps, alphaVal, false); |
| if (testPassed) |
| pass(); |