Skip to content

Commit 11fdbdc

Browse files
committed
Fix cpu-render.html coordinate space
This should ensure that CPU/GPU diffs are actually useful, and not improperly shifted.
1 parent 7a11188 commit 11fdbdc

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/integration/cpu-render.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@
5353
return { id, drawable };
5454
}).filter(Boolean);
5555
const color = new Uint8ClampedArray(3);
56-
for (let x = -239; x <= 240; x++) {
57-
for (let y = -180; y< 180; y++) {
58-
render.constructor.sampleColor3b([x, y], drawBits, color);
59-
const offset = (((179-y) * 480) + 239 + x) * 4
56+
const vec = [0, 0];
57+
for (let x = 0; x < 480; x++) {
58+
// leftmost pixel is -240, rightmost is 239
59+
vec[0] = x - 240;
60+
for (let y = 0; y < 360; y++) {
61+
// bottommost pixel is -179, topmost is 180
62+
vec[1] = 180 - y;
63+
render.constructor.sampleColor3b(vec, drawBits, color);
64+
const offset = ((y * 480) + x) * 4;
6065
cpuImageData.data.set(color, offset);
6166
}
6267
}

0 commit comments

Comments
 (0)