<html>
<script src="./resources/webgl-test-utils-full.js"></script>
<script src="./resources/tex-image-and-sub-image-utils.js"></script>
<script src="./resources/tex-image-and-sub-image-image-bitmap-utils-resize.js"></script>
<body>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
function setCanvasToRedGreen(ctx) {
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);
}
var testCanvas = document.createElement('canvas');
testCanvas.width = 2;
testCanvas.height = 2;
var offscreen = testCanvas.transferControlToOffscreen();
var ctx = offscreen.getContext("2d");
setCanvasToRedGreen(ctx);
var canvas = document.createElement('canvas');
canvas.width = 400;
canvas.height = 400;
document.body.appendChild(canvas);
var testOptions = {sourceName: "OffscreenCanvas", imageSource: offscreen,
sourceIsPremul: true, resizeWidth: 16, resizeHeight: 16,
resultsCanvas: canvas, printDebugInfoToConsole: false};
prepareWebGLContext(testOptions);
prepareResizedImageBitmapsAndRuntTests(testOptions);
</script>