From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.bugs Subject: bug#37153: 26.1; some png images scrambled Date: Mon, 26 Aug 2019 08:02:23 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <5b006777-5e97-a641-6f93-83a437ca9ca7@cs.ucla.edu> <44134.15891.158963.23904@gargle.gargle.HOWL> <9c4c68ebe20cbcc44763be8e72bd25eb.squirrel@weber.math.s.chiba-u.ac.jp> <5136.20784.40920.23906@gargle.gargle.HOWL> <4a893dc7-659a-be76-01d3-3f0a4de57ba4@cs.ucla.edu> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="73444"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 37153@debbugs.gnu.org, Roland Winkler To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 26 01:03:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i21XU-000Ixa-OI for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Aug 2019 01:03:12 +0200 Original-Received: from localhost ([::1]:48640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i21XT-00006o-1I for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Aug 2019 19:03:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40103) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i21XL-00006T-9V for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2019 19:03:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i21XK-0002iz-5f for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2019 19:03:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36410) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i21XK-0002ir-2x for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2019 19:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i21XJ-0006qC-U9 for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2019 19:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: YAMAMOTO Mitsuharu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Aug 2019 23:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37153 X-GNU-PR-Package: emacs Original-Received: via spool by 37153-submit@debbugs.gnu.org id=B37153.156677415026258 (code B ref 37153); Sun, 25 Aug 2019 23:03:01 +0000 Original-Received: (at 37153) by debbugs.gnu.org; 25 Aug 2019 23:02:30 +0000 Original-Received: from localhost ([127.0.0.1]:45231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i21Wm-0006pP-Gc for submit@debbugs.gnu.org; Sun, 25 Aug 2019 19:02:28 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:62257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i21Wi-0006pC-Us for 37153@debbugs.gnu.org; Sun, 25 Aug 2019 19:02:26 -0400 Original-Received: from mathent.math.s.chiba-u.ac.jp (mathent [192.168.32.5]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 67836F08E0; Mon, 26 Aug 2019 08:02:23 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) In-Reply-To: <4a893dc7-659a-be76-01d3-3f0a4de57ba4@cs.ucla.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165863 Archived-At: On Mon, 26 Aug 2019 03:38:07 +0900, Paul Eggert wrote: > > YAMAMOTO Mitsuharu wrote: > > > It seems to be necessary to look into the tRNS chunk data for paletted > > images. Again, W32 would need some more work. > > Thanks, I confirmed that this fixes the misdisplay for me as well. I > attempted to port it to w32 (as well as to unusual libpng builds that > do not define PNG_tRNS_SUPPORTED) and installed the attached into > master. > > With this patch on Ubuntu 18.04.3 I always see the first image shown > in your tRNS.pg screenshot . So it may > be that more work needs to be done to support other faces. Still, this > patch is an improvement so it's worth going in. At least, your patch misses the case of non-paletted transparent PNGs (tb???c?? in http://www.schaik.com/pngsuite2011/pngsuite_trn_png.html). YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp diff --git a/src/image.c b/src/image.c index 18495612e98..8c4ab096938 100644 --- a/src/image.c +++ b/src/image.c @@ -6598,15 +6598,19 @@ 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)) + if (!trans_alpha) transparent_p = true; + else + { + 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; + } } # endif