mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-20 14:25:40 +00:00
Fix SDL_SetWindowIcon on singlethreaded Emscripten builds (#14850)
This commit is contained in:
@@ -794,11 +794,9 @@ static bool Emscripten_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
|
||||
// Pass PNG data to JavaScript
|
||||
MAIN_THREAD_EM_ASM({
|
||||
var pngData = HEAPU8.subarray($0, $0 + $1);
|
||||
if (pngData.buffer instanceof SharedArrayBuffer) {
|
||||
// explicitly create a copy
|
||||
pngData = new Uint8Array(pngData);
|
||||
}
|
||||
// Use `.slice` to make a copy of the data if we are dealing with a SharedArrayBuffer, or `.subarray` to create a
|
||||
// view into the existing buffer if its non-shared.
|
||||
var pngData = HEAPU8.buffer instanceof ArrayBuffer ? HEAPU8.subarray($0, $0 + $1) : HEAPU8.slice($0, $0 + $1);
|
||||
|
||||
var blob = new Blob([pngData], {type: 'image/png'});
|
||||
var url = URL.createObjectURL(blob);
|
||||
|
||||
Reference in New Issue
Block a user