SDL-emscripten
SDL-emscripten copied to clipboard
Change SDL pixel format to match HTML Canvas.
Both standard createImageData() and CanvasPixelArray order bytes as red, green, blue, alpha. Emscripten is little endian, and the the order of characters in SDL_PIXELFORMAT_ defines refers to most to least significant order in a word, so this corresponds to BGR order. The pixel format must match because Emscripten_UpdateWindowFramebuffer() copies 32 bits without rearranging when not using CanvasPixelArray. Otherwise, red and blue are swapped.