blob: 4f0ee5cd086ce1a18d57ab96f7b498c284fe2e1e [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
</head>
<body>
This test makes sure that putImageData() isn't affected by subsequent changes to the ImageData. The test passes if you see a green square below.
<div><canvas id="canvas" width="100" height="100"></canvas></div>
<script>
let canvas = document.getElementById("canvas");
let context = canvas.getContext("2d");
let width = 100;
let height = 100;
let imageData = context.createImageData(width, height);
let data = imageData.data;
for (let i = 0; i < width * height; ++i) {
data[4 * i + 0] = 0;
data[4 * i + 1] = 255;
data[4 * i + 2] = 0;
data[4 * i + 3] = 255;
}
context.putImageData(imageData, 0, 0);
for (let i = 0; i < width * height; ++i) {
data[4 * i + 0] = 255;
data[4 * i + 1] = 0;
data[4 * i + 2] = 0;
data[4 * i + 3] = 255;
}
</script>
</body>
</html>