INNER CODE UNIT · TypeScript
pixelCount
mantou132/nesbox · packages/arcade/src/index.ts:116
const pixelCount = this.#width * this.#height;
if (this.#vidBits === 16) {
const b = new Uint8Array(this.#fbneo!.HEAP8.buffer, vidImagePtr, pixelCount << 1);
let index = 0;
for (let i = 0; i < pixelCount; i++) {
const offset = i << 1;
const color = ((b[offset + 1] << 8) & 0xff00) | (b[offset] & 0xff);
currentFrame[index++] = ((color >> 11) & 0x1f) << 3;
currentFrame[index++] = ((color >> 5) & 0x3f) << 2;
currentFrame[index++] = (color & 0x1f) << 3;
currentFrame[index++] = 255;
}
} else {
const b = new Uint8Array(this.#fbneo!.HEAP8.buffer, vidImagePtr, pixelCount << 2);
let index = 0;
for (let i = 0; i < pixelCount; i++) {
const offset = i << 2;
currentFrame[index++] = b[offset + 2];