Fixed assertion loading button.bmp in testgamecontroller
authorSam Lantinga <slouken@libsdl.org>
Sat, 29 Mar 2014 12:27:27 -0700
changeset 86871d2ca48523a7
parent 8686 5af17a98f458
child 8688 1543a7183f88
Fixed assertion loading button.bmp in testgamecontroller
test/testgamecontroller.c
     1.1 --- a/test/testgamecontroller.c	Sat Mar 29 12:27:02 2014 -0700
     1.2 +++ b/test/testgamecontroller.c	Sat Mar 29 12:27:27 2014 -0700
     1.3 @@ -85,9 +85,13 @@
     1.4      } else {
     1.5          /* Set transparent pixel as the pixel at (0,0) */
     1.6          if (transparent) {
     1.7 -            SDL_assert(!temp->format->palette);
     1.8 -            SDL_assert(temp->format->BitsPerPixel == 24);
     1.9 -            SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *) temp->pixels) & 0x00FFFFFF);
    1.10 +            if (temp->format->BytesPerPixel == 1) {
    1.11 +                SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
    1.12 +            } else {
    1.13 +                SDL_assert(!temp->format->palette);
    1.14 +                SDL_assert(temp->format->BitsPerPixel == 24);
    1.15 +                SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *)temp->pixels) & 0x00FFFFFF);
    1.16 +            }
    1.17          }
    1.18  
    1.19          texture = SDL_CreateTextureFromSurface(renderer, temp);