From ed19d057875a6a9e77db903517b6d31133662806 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Thu, 7 May 2020 19:14:42 -0400 Subject: [PATCH] Fix cpu-render.html coordinate space This should ensure that CPU/GPU diffs are actually useful, and not improperly shifted. --- test/integration/cpu-render.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/integration/cpu-render.html b/test/integration/cpu-render.html index 468601c33..0cc5b7d69 100644 --- a/test/integration/cpu-render.html +++ b/test/integration/cpu-render.html @@ -53,10 +53,15 @@ return { id, drawable }; }).filter(Boolean); const color = new Uint8ClampedArray(3); - for (let x = -239; x <= 240; x++) { - for (let y = -180; y< 180; y++) { - render.constructor.sampleColor3b([x, y], drawBits, color); - const offset = (((179-y) * 480) + 239 + x) * 4 + const vec = [0, 0]; + for (let x = 0; x < 480; x++) { + // leftmost pixel is -240, rightmost is 239 + vec[0] = x - 240; + for (let y = 0; y < 360; y++) { + // bottommost pixel is -179, topmost is 180 + vec[1] = 180 - y; + render.constructor.sampleColor3b(vec, drawBits, color); + const offset = ((y * 480) + x) * 4; cpuImageData.data.set(color, offset); } }