unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Cc: 37153@debbugs.gnu.org, Roland Winkler <winkler@gnu.org>
Subject: bug#37153: 26.1; some png images scrambled
Date: Sun, 25 Aug 2019 16:39:11 -0700	[thread overview]
Message-ID: <023ff38a-104e-be32-b605-94caecd3fb2d@cs.ucla.edu> (raw)
In-Reply-To: <wlblwckfwg.wl-mituharu@math.s.chiba-u.ac.jp>

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

YAMAMOTO Mitsuharu wrote:

> At least, your patch misses the case of non-paletted transparent PNGs
> (tb???c?? in http://www.schaik.com/pngsuite2011/pngsuite_trn_png.html).

Thanks for catching my mistake. I installed the attached patch, which is closer 
to the code you originally suggested. With it, displaying one of the images you 
suggested looks like the attached image; hope it's what you're looking for. (I 
disabled font-lock-mode as you also suggested.)

[-- Attachment #2: 0001-Fix-bug-with-non-paletted-transparent-PNGs.patch --]
[-- Type: text/x-patch, Size: 1297 bytes --]

From d3b17dd5f5e3805342dbe4ae20706e9520c48179 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 25 Aug 2019 16:35:43 -0700
Subject: [PATCH] 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 18495612e9..fe7bd90b05 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
 
-- 
2.17.1


[-- Attachment #3: display-tbrn2c08.png --]
[-- Type: image/png, Size: 18246 bytes --]

  parent reply	other threads:[~2019-08-25 23:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  4:49 bug#37153: 26.1; some png images scrambled Roland Winkler
2019-08-23  8:47 ` Eli Zaretskii
2019-08-23 11:39   ` Roland Winkler
2019-08-23 12:22     ` Eli Zaretskii
2019-08-23 15:07       ` Roland Winkler
2019-08-23 15:34         ` Eli Zaretskii
2019-08-23 19:37 ` Paul Eggert
2019-08-23 20:11   ` Eli Zaretskii
2019-08-23 20:33     ` Paul Eggert
2019-08-24  5:51       ` Eli Zaretskii
2019-08-24  3:17   ` Roland Winkler
2019-08-24  3:39     ` Paul Eggert
2019-08-24  4:19       ` Roland Winkler
2019-08-24  6:26       ` Eli Zaretskii
2019-08-24  6:22     ` Eli Zaretskii
2019-08-24  9:01     ` mituharu
2019-08-24 10:17       ` Eli Zaretskii
2019-08-25  4:19         ` YAMAMOTO Mitsuharu
2019-08-25  7:24           ` Eli Zaretskii
2019-08-25  4:52       ` Roland Winkler
2019-08-25  6:58         ` YAMAMOTO Mitsuharu
2019-08-25 12:19           ` Roland Winkler
2019-08-25 18:38           ` Paul Eggert
2019-08-25 18:56             ` Eli Zaretskii
2019-08-25 23:02             ` YAMAMOTO Mitsuharu
2019-08-25 23:06               ` YAMAMOTO Mitsuharu
2019-08-25 23:39               ` Paul Eggert [this message]
2019-09-24 16:23                 ` Lars Ingebrigtsen
2019-09-24 17:14                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=023ff38a-104e-be32-b605-94caecd3fb2d@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=37153@debbugs.gnu.org \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    --cc=winkler@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).