From e0a1a2c90e9c3f0fd993406165e3d5250a671877 Mon Sep 17 00:00:00 2001 From: Mike Gorchak Date: Wed, 10 Jun 2009 05:54:19 +0000 Subject: [PATCH] Support for 15/16/24/32 bpps of icon.bmp has been added, in case if not an original icon.bmp (8bpp with palette) is used for tests. --- test/testsprite2.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testsprite2.c b/test/testsprite2.c index 9650b7710..8a8f08b9a 100644 --- a/test/testsprite2.c +++ b/test/testsprite2.c @@ -58,6 +58,21 @@ LoadSprite(char *file) /* Set transparent pixel as the pixel at (0,0) */ if (temp->format->palette) { SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_SRCCOLORKEY, (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_SRCCOLORKEY, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint32 *) temp->pixels); + break; + } } /* Create textures from the image */