diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-25 16:35:43 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-25 16:36:15 -0700 |
commit | fffefeecc81aad1b0a8e00032de66e2502c86547 (patch) | |
tree | 927d6d515408b5349c7a4e305c05cafc2c60535f /src/image.c | |
parent | 8826beaf00660eaaeff28016e022af1d9bf40b7c (diff) | |
download | emacs-fffefeecc81aad1b0a8e00032de66e2502c86547.tar.gz emacs-fffefeecc81aad1b0a8e00032de66e2502c86547.tar.bz2 emacs-fffefeecc81aad1b0a8e00032de66e2502c86547.zip |
Fix bug with non-paletted transparent PNGs
Adapted from a fix by YAMAMOTO Mitsuharu (Bug#37153#77).
* src/image.c (png_load_body): Fix bug with non-paletted
transparent images.
Diffstat (limited to 'src/image.c')
-rw-r--r-- | src/image.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/image.c b/src/image.c index 18495612e98..fe7bd90b051 100644 --- a/src/image.c +++ b/src/image.c @@ -6598,15 +6598,16 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) # ifdef PNG_tRNS_SUPPORTED png_bytep trans_alpha; int num_trans; - if (png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, NULL) - && trans_alpha) + if (png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, NULL)) { - int i; - for (i = 0; i < num_trans; i++) - if (0 < trans_alpha[i] && trans_alpha[i] < 255) - break; - if (! (i < num_trans)) - transparent_p = true; + transparent_p = true; + if (trans_alpha) + for (int i = 0; i < num_trans; i++) + if (0 < trans_alpha[i] && trans_alpha[i] < 255) + { + transparent_p = false; + break; + } } # endif |