diff options
author | nandhp <nandhp@gmail.com> | 2012-07-11 10:30:29 -0500 |
---|---|---|
committer | nandhp <nandhp@gmail.com> | 2012-07-11 10:30:29 -0500 |
commit | 81bbbc3de43d3ea898b1b964d7e5fb668fdf8622 (patch) | |
tree | f91bd59e848b749129fb84d6ef400db9fc0e7f9d /src | |
parent | faebd713187b473fa7090c15169618a7af5cbcc8 (diff) |
Fix SDL_MapRGB and implement SDL_MapRGBA.
Also provide a test case.
Diffstat (limited to 'src')
-rw-r--r-- | src/library_sdl.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 88649c38..73848502 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -952,7 +952,12 @@ var LibrarySDL = { SDL_MapRGB: function(fmt, r, g, b) { // Canvas screens are always RGBA - return r + (g << 8) + (b << 16); + return 0xff+((b&0xff)<<8)+((g&0xff)<<16)+((r&0xff)<<24) + }, + + SDL_MapRGBA: function(fmt, r, g, b, a) { + // Canvas screens are always RGBA + return (a&0xff)+((b&0xff)<<8)+((g&0xff)<<16)+((r&0xff)<<24) }, SDL_WM_GrabInput: function() {}, |