diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-17 12:04:00 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-17 12:04:00 -0800 |
commit | e5d7fe031372fe3f17d6a7cc916b28d96250dd23 (patch) | |
tree | d1a7321a304685b4ac4edd1092505baa29ee329d | |
parent | 904ed62b5c790603474e52632ed29bd872a0a987 (diff) |
fix SDL_MUSTLOCK
-rw-r--r-- | system/include/SDL/SDL_surface.h | 4 | ||||
-rw-r--r-- | tests/hello_world_sdl.cpp | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/system/include/SDL/SDL_surface.h b/system/include/SDL/SDL_surface.h index 77b58258..ecf89606 100644 --- a/system/include/SDL/SDL_surface.h +++ b/system/include/SDL/SDL_surface.h @@ -59,7 +59,9 @@ extern "C" { /** * Evaluates to true if the surface needs to be locked before access. */ -#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) +#define SDL_MUSTLOCK(S) 1 + /* XXX Emscripten: we always need to lock. + (((S)->flags & SDL_RLEACCEL) != 0) */ /** * \brief A collection of pixels used in software blitting. diff --git a/tests/hello_world_sdl.cpp b/tests/hello_world_sdl.cpp index f3fb8ae7..df69b055 100644 --- a/tests/hello_world_sdl.cpp +++ b/tests/hello_world_sdl.cpp @@ -8,7 +8,7 @@ int main() { SDL_Init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(256, 256, 32, SDL_SWSURFACE); - SDL_LockSurface(screen); + if (SDL_MUSTLOCK(screen)) SDL_LockSurface(screen); for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { *((char*)screen->pixels + i*256*4 + j*4 + 0) = i; @@ -17,7 +17,7 @@ int main() { *((char*)screen->pixels + i*256*4 + j*4 + 3) = 255; } } - SDL_UnlockSurface(screen); + if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); SDL_Flip(screen); printf("you should see a colored cube."); |