diff options
| author | Paul Eggert | 2019-08-25 16:35:43 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-08-25 16:36:15 -0700 |
| commit | fffefeecc81aad1b0a8e00032de66e2502c86547 (patch) | |
| tree | 927d6d515408b5349c7a4e305c05cafc2c60535f /src | |
| parent | 8826beaf00660eaaeff28016e022af1d9bf40b7c (diff) | |
| download | emacs-fffefeecc81aad1b0a8e00032de66e2502c86547.tar.gz 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')
| -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) | |||
| 6598 | # ifdef PNG_tRNS_SUPPORTED | 6598 | # ifdef PNG_tRNS_SUPPORTED |
| 6599 | png_bytep trans_alpha; | 6599 | png_bytep trans_alpha; |
| 6600 | int num_trans; | 6600 | int num_trans; |
| 6601 | if (png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, NULL) | 6601 | if (png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, NULL)) |
| 6602 | && trans_alpha) | ||
| 6603 | { | 6602 | { |
| 6604 | int i; | 6603 | transparent_p = true; |
| 6605 | for (i = 0; i < num_trans; i++) | 6604 | if (trans_alpha) |
| 6606 | if (0 < trans_alpha[i] && trans_alpha[i] < 255) | 6605 | for (int i = 0; i < num_trans; i++) |
| 6607 | break; | 6606 | if (0 < trans_alpha[i] && trans_alpha[i] < 255) |
| 6608 | if (! (i < num_trans)) | 6607 | { |
| 6609 | transparent_p = true; | 6608 | transparent_p = false; |
| 6609 | break; | ||
| 6610 | } | ||
| 6610 | } | 6611 | } |
| 6611 | # endif | 6612 | # endif |
| 6612 | 6613 | ||