Skip to content

Commit

Permalink
Merge branch 'sdl' of github.com:sronsse/emscripten into incoming
Browse files Browse the repository at this point in the history
Conflicts:
	AUTHORS
  • Loading branch information
kripken committed Jul 1, 2014
2 parents b9d8ce8 + 923c144 commit 349be82
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,5 @@ a license to everyone to use it as detailed in LICENSE.)
* Sathyanarayanan Gunasekaran <[email protected]> (copyright owned by Mozilla Foundation)
* Nikolay Vorobyov <[email protected]>
* Jonas Platte <[email protected]>
* Sebastien Ronsse <[email protected]>

31 changes: 31 additions & 0 deletions src/library_sdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,35 @@ var LibrarySDL = {
return r&0xff|(g&0xff)<<8|(b&0xff)<<16|(a&0xff)<<24;
},

SDL_GetRGB: function(pixel, fmt, r, g, b) {
// Canvas screens are always RGBA. We assume the machine is little-endian.
if (r) {
{{{ makeSetValue('r', '0', 'pixel&0xff', 'i8') }}};
}
if (g) {
{{{ makeSetValue('g', '0', '(pixel>>8)&0xff', 'i8') }}};
}
if (b) {
{{{ makeSetValue('b', '0', '(pixel>>16)&0xff', 'i8') }}};
}
},

SDL_GetRGBA: function(pixel, fmt, r, g, b, a) {
// Canvas screens are always RGBA. We assume the machine is little-endian.
if (r) {
{{{ makeSetValue('r', '0', 'pixel&0xff', 'i8') }}};
}
if (g) {
{{{ makeSetValue('g', '0', '(pixel>>8)&0xff', 'i8') }}};
}
if (b) {
{{{ makeSetValue('b', '0', '(pixel>>16)&0xff', 'i8') }}};
}
if (a) {
{{{ makeSetValue('a', '0', '(pixel>>24)&0xff', 'i8') }}};
}
},

SDL_GetAppState: function() {
var state = 0;

Expand Down Expand Up @@ -2977,6 +3006,8 @@ var LibrarySDL = {

SDL_getenv: 'getenv',

SDL_putenv: 'putenv',

// TODO

SDL_SetGamma: function(r, g, b) {
Expand Down

0 comments on commit 349be82

Please sign in to comment.