Skip to content

Commit

Permalink
Fixed bug setting colorkey for indexed PNG images
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 23, 2013
1 parent 29378f8 commit afa8d0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES
@@ -1,4 +1,6 @@
2.0.0:
Sam Lantinga - Sat Mar 23 13:36:51 PDT 2013
* Fixed bug setting colorkey for indexed PNG images
Torsten Stremlau - Sun Mar 10 10:19:25 PDT 2013
* Added support for alpha and lossless WEBP images

Expand Down
11 changes: 7 additions & 4 deletions IMG_png.c
Expand Up @@ -424,13 +424,16 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
if (color_type == PNG_COLOR_TYPE_PALETTE) {
/* Check if all tRNS entries are opaque except one */
int j, t = -1;
for (j = 0; j < num_trans; j++)
for (j = 0; j < num_trans; j++) {
if (trans[j] == 0) {
if (t >= 0)
if (t >= 0) {
break;
t = i;
} else if (trans[j] != 255)
}
t = j;
} else if (trans[j] != 255) {
break;
}
}
if (j == num_trans) {
/* exactly one transparent index */
ckey = t;
Expand Down

0 comments on commit afa8d0d

Please sign in to comment.