diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-18 19:22:09 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-18 19:22:09 -0700 |
commit | 1c11fdd98530b6d35e51c0eba14fb1f375d05229 (patch) | |
tree | bd471ce02003d0e1d16dfe773d1ed4d0acdcb499 /tests/sdl_image.c | |
parent | d6cff2177ec065aa14f228ab547abc29ef37b248 (diff) | |
parent | 327b6f859e95be71e5613f24cc1c9d4f4b97c15f (diff) |
merge
Diffstat (limited to 'tests/sdl_image.c')
-rw-r--r-- | tests/sdl_image.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/sdl_image.c b/tests/sdl_image.c new file mode 100644 index 00000000..d934f863 --- /dev/null +++ b/tests/sdl_image.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <SDL/SDL.h> +#include <SDL/SDL_image.h> +#include <assert.h> +#include <emscripten.h> + +int main() { + SDL_Init(SDL_INIT_VIDEO); + SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE); + + SDL_Surface *image = IMG_Load("screenshot.jpg"); + if (!image) + { + printf("IMG_Load: %s\n", IMG_GetError()); + return 1; + } + assert(image->format->BitsPerPixel == 32); + assert(image->format->BytesPerPixel == 4); + assert(image->pitch == 4*image->w); + + SDL_BlitSurface (image, NULL, screen, NULL); + SDL_FreeSurface (image); + + SDL_Flip(screen); + + printf("you should see an image.\n"); + + SDL_Quit(); + + int result = image->w; + REPORT_RESULT(); + + return 0; +} + |