Skip to content

Commit

Permalink
Fixed assertion loading button.bmp in testgamecontroller
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 29, 2014
1 parent 20680d7 commit 229b438
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/testgamecontroller.c
Expand Up @@ -85,9 +85,13 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
} else {
/* Set transparent pixel as the pixel at (0,0) */
if (transparent) {
SDL_assert(!temp->format->palette);
SDL_assert(temp->format->BitsPerPixel == 24);
SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *) temp->pixels) & 0x00FFFFFF);
if (temp->format->BytesPerPixel == 1) {
SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
} else {
SDL_assert(!temp->format->palette);
SDL_assert(temp->format->BitsPerPixel == 24);
SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *)temp->pixels) & 0x00FFFFFF);
}
}

texture = SDL_CreateTextureFromSurface(renderer, temp);
Expand Down

0 comments on commit 229b438

Please sign in to comment.