diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-03 17:32:49 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-03 17:32:49 -0800 |
commit | 15253e694911f203c5ecd4f7577a42289554f79e (patch) | |
tree | 25c8f8061c5fb7634126a1f9a2f0df4cd7009799 | |
parent | c67e7e831cfd3c67b533f9e44b75c0925a5c52b9 (diff) | |
parent | 5f21294665db19cc072645cb87f8a0e2210141ba (diff) |
Merge pull request #1973 from jvilk/sdl_fix
[SDL] Actually fix SDL_UnlockSurface in IE10/IE11.
-rw-r--r-- | src/library_sdl.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 78f6a628..cc969c27 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1056,23 +1056,27 @@ var LibrarySDL = { var buffer = surfData.buffer; #if USE_TYPED_ARRAYS == 2 assert(buffer % 4 == 0, 'Invalid buffer offset: ' + buffer); - var src; + var src = buffer >> 2; var dst = 0; var isScreen = surf == SDL.screen; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { - // IE10/IE11: Canvases are backed by the deprecated CanvasPixelArray, + // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, // not UInt8ClampedArray. These don't have buffers, so we need to revert // to copying a byte at a time. We do the undefined check because modern // browsers do not define CanvasPixelArray anymore. - src = buffer; num = data.length; while (dst < num) { - data[dst++] = HEAP8[src++]; + var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data[dst ] = val & 0xff; + data[dst+1] = (val >> 8) & 0xff; + data[dst+2] = (val >> 16) & 0xff; + data[dst+3] = isScreen ? 0xff : ((val >> 24) & 0xff); + src++; + dst += 4; } } else { var data32 = new Uint32Array(data.buffer); - src = buffer >> 2; num = data32.length; while (dst < num) { // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; |