Commit 05b71a0f authored by Mike Gorchak's avatar Mike Gorchak

Support for 15/16/24/32 bpps of icon.bmp has been added, in case if not an...

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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403641
parent 66dca33f
...@@ -58,6 +58,21 @@ LoadSprite(char *file) ...@@ -58,6 +58,21 @@ LoadSprite(char *file)
/* Set transparent pixel as the pixel at (0,0) */ /* Set transparent pixel as the pixel at (0,0) */
if (temp->format->palette) { if (temp->format->palette) {
SDL_SetColorKey(temp, SDL_SRCCOLORKEY, *(Uint8 *) temp->pixels); 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 */ /* Create textures from the image */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment