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 /tests/hello_world_sdl.cpp | |
parent | 904ed62b5c790603474e52632ed29bd872a0a987 (diff) |
fix SDL_MUSTLOCK
Diffstat (limited to 'tests/hello_world_sdl.cpp')
-rw-r--r-- | tests/hello_world_sdl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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."); |