SDL-emscripten icon indicating copy to clipboard operation
SDL-emscripten copied to clipboard

Change SDL pixel format to match HTML Canvas.

Open dreamlayers opened this issue 10 years ago • 0 comments

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.

dreamlayers avatar Jan 09 '15 04:01 dreamlayers