Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Support for 15/16/24/32 bpps of icon.bmp has been added, in case if n…
Browse files Browse the repository at this point in the history
…ot an original icon.bmp (8bpp with palette) is used for tests.
  • Loading branch information
llmike committed Jun 10, 2009
1 parent c941ffd commit e0a1a2c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/testsprite2.c
Expand Up @@ -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 */
Expand Down

0 comments on commit e0a1a2c

Please sign in to comment.