emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master fffefee: Fix bug with non-paletted transparent PNGs


From: Paul Eggert
Subject: [Emacs-diffs] master fffefee: Fix bug with non-paletted transparent PNGs
Date: Sun, 25 Aug 2019 19:36:20 -0400 (EDT)

branch: master
commit fffefeecc81aad1b0a8e00032de66e2502c86547
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 src/image.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/image.c b/src/image.c
index 1849561..fe7bd90 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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]