From: Eli Zaretskii <eliz@gnu.org>
To: "Juan José García-Ripoll" <juanjose.garciaripoll@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: GDI+ take 3
Date: Tue, 21 Apr 2020 17:13:25 +0300 [thread overview]
Message-ID: <83lfmpexkq.fsf@gnu.org> (raw)
In-Reply-To: <86h7xd72yq.fsf@csic.es> (juanjose.garciaripoll@gmail.com)
> From: Juan José García-Ripoll
> <juanjose.garciaripoll@gmail.com>
> Date: Tue, 21 Apr 2020 08:44:13 +0200
>
> > That makes some assumptions I felt uneasy about. First, it assumes
> > that the native_image entry will never have an init method; this could
> > become wrong at some future point, at which time someone will have to
> > remember to adapt initialize_image_type to handle that (since
> > native_image doesn't really have a library to load).
>
> I do not think this is right. The current implementation is
>
> - Something wants to load an image and invokes lookup_image_type()
> - lookup_image_type() calls image_can_use_native_api
> + within image_can_use_native_api, the type of image is verified
> - if it is right, it _initializes_ gdi+ (= init method)
> - otherwise returns false
> + when image_can_use_native_api returns false, lookup_image_type
> loops over image type
> - for each image type it calls initialize_image_type()
> * initialize_image_type aclls image_can_use_native_api again!
> * it then invokes the initialization method
>
> So, in the current architecture, image_can_use_native_api() is called
> redundantly.
Yes, but it's very fast. And also, is the above flow the only one?
Can we ever call initialize_image_type directly? Doesn't that happen
when we first time call image-type-available-p, for example? Such a
call can be issued by Lisp which tries to see if a certain type of
images can be displayed, and if not, use some fallback.
> > Second, what happens if the TYPE argument specifies an image type the
> > native_image cannot handle (e.g., SVG), and the corresponding optional
> > image library is not linked in or is unavailable at run time? With
> > your patch, we would return true, right?
>
> No. It would call the initialization method.
I think we may be miscommunicating. If Emacs is built without
librsvg, the HAVE_RSVG macro is not defined, and the SVG part of the
image_types[] array and init_svg_functions are not compiled into
Emacs. So there's no initialization method to call for SVG images,
and initialize_image_type should return false.
> > You are right. However, I believe I already fixed that, albeit a bit
> > differently, as part of commit 423089d (after bumping into the same
> > problem during testing my recent changes). We can use your change
> > instead, if you think it is better for some reason.
>
> I am not sure. I pulled latest emacs and w32_frame_delay() currently has
> this
>
> delay = decode_delay (propertyItem, frame);
> if (delay <= 0)
> {
> /* In GIF files, unfortunately, delay is only specified
> for the first frame. */
> delay = decode_delay (propertyItem, 0);
> }
>
> This code is wrong. It originates in my wrong decoding from
> PropertyItem. I was testing the GDI+ library with various GIF files and
> they returned 0 for the delay at later frames, but it was because I
> misunderstood how Property Item works. It should read
>
> delay = decode_delay (propertyItem, frame);
OK, I'll remove that part.
> Now, in both cases (before and with this change) the output of this
> function is used here (this is the code in master).
>
> if (delay >= 0)
> metadata = Fcons (Qdelay, Fcons (make_float (delay), metadata));
>
> If delay == 0, it should not be returned. But I suppose it is just
> nitpicking.
I thought a delay of zero was a valid value. But if it isn't, you
are, of course, right, and we should change the inequality to use >.
next prev parent reply other threads:[~2020-04-21 14:13 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-04 21:25 GDI+ take 3 Juan José García-Ripoll
2020-04-05 12:58 ` Eli Zaretskii
2020-04-13 6:19 ` Eli Zaretskii
2020-04-13 10:04 ` Juan José García-Ripoll
2020-04-14 15:33 ` Eli Zaretskii
2020-04-14 17:43 ` Eli Zaretskii
2020-04-14 22:19 ` Alan Third
2020-04-16 18:39 ` Eli Zaretskii
2020-04-14 18:38 ` Dmitry Gutov
2020-04-14 18:43 ` Eli Zaretskii
2020-04-14 19:38 ` Dmitry Gutov
2020-04-14 19:08 ` Basil L. Contovounesios
2020-04-14 19:24 ` Eli Zaretskii
2020-04-14 21:57 ` Basil L. Contovounesios
2020-04-15 6:18 ` Eli Zaretskii
2020-04-15 13:40 ` Juanma Barranquero
2020-04-15 14:00 ` Eli Zaretskii
2020-04-15 14:12 ` Juanma Barranquero
2020-04-15 14:17 ` Juanma Barranquero
2020-04-15 14:28 ` Eli Zaretskii
2020-04-15 14:35 ` Juanma Barranquero
2020-04-15 14:43 ` Eli Zaretskii
2020-04-15 14:47 ` Juanma Barranquero
2020-04-15 15:00 ` Juanma Barranquero
2020-04-15 15:02 ` Juanma Barranquero
2020-04-15 15:10 ` Eli Zaretskii
2020-04-15 15:31 ` Juanma Barranquero
2020-04-15 15:46 ` Eli Zaretskii
2020-04-15 15:56 ` Eli Zaretskii
2020-04-15 16:08 ` Eli Zaretskii
2020-04-15 16:50 ` Juanma Barranquero
2020-04-15 16:59 ` Eli Zaretskii
2020-04-15 17:24 ` Juanma Barranquero
2020-04-15 17:34 ` Eli Zaretskii
2020-04-15 17:49 ` Juanma Barranquero
2020-04-15 18:13 ` Eli Zaretskii
2020-04-15 18:45 ` Juanma Barranquero
2020-04-15 20:21 ` Eli Zaretskii
2020-04-15 20:31 ` Juanma Barranquero
2020-04-16 10:04 ` Eli Zaretskii
2020-04-16 23:49 ` Juanma Barranquero
2020-04-17 6:55 ` Eli Zaretskii
2020-04-17 7:27 ` Juan José García-Ripoll
2020-04-17 8:36 ` Juanma Barranquero
2020-04-17 9:52 ` Eli Zaretskii
2020-04-18 8:41 ` Juan José García-Ripoll
2020-04-18 10:00 ` Eli Zaretskii
2020-04-18 10:09 ` Juanma Barranquero
2020-04-18 12:38 ` Juan José García-Ripoll
2020-04-18 13:38 ` Eli Zaretskii
2020-04-18 15:56 ` Juanma Barranquero
2020-04-18 16:15 ` Eli Zaretskii
2020-04-18 17:51 ` Juan José García-Ripoll
2020-04-18 18:01 ` Eli Zaretskii
2020-04-18 18:04 ` Eli Zaretskii
2020-04-18 18:49 ` Juanma Barranquero
2020-04-18 19:15 ` Eli Zaretskii
2020-04-18 20:19 ` Alan Third
2020-04-19 10:20 ` Juan José García-Ripoll
2020-04-19 20:08 ` Juan José García-Ripoll
2020-04-20 13:37 ` Eli Zaretskii
2020-04-21 7:35 ` Juan José García-Ripoll
2020-04-21 14:15 ` Eli Zaretskii
2020-04-21 18:17 ` Alan Third
2020-04-21 18:34 ` Eli Zaretskii
2020-04-25 16:51 ` Alan Third
2020-04-20 20:16 ` Alan Third
2020-04-21 6:25 ` Juan José García-Ripoll
2020-04-25 16:23 ` Alan Third
2020-04-25 13:42 ` Eli Zaretskii
2020-04-26 15:14 ` Juan José García-Ripoll
2020-04-19 18:16 ` Eli Zaretskii
2020-04-19 20:28 ` Juan José García-Ripoll
2020-04-20 13:54 ` Eli Zaretskii
2020-04-21 6:44 ` Juan José García-Ripoll
2020-04-21 14:13 ` Eli Zaretskii [this message]
2020-04-21 16:20 ` Juan José García-Ripoll
2020-04-15 16:50 ` Eli Zaretskii
2020-04-15 14:27 ` Eli Zaretskii
[not found] <617217672.240027.1586079490291@mail1.libero.it>
2020-04-15 14:07 ` Angelo Graziosi
2020-04-15 14:15 ` Eli Zaretskii
2020-04-15 14:22 ` Angelo Graziosi
2020-04-15 14:26 ` Eli Zaretskii
2020-04-15 15:25 ` Angelo Graziosi
2020-04-15 15:27 ` Eli Zaretskii
2020-04-15 15:46 ` Angelo Graziosi
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83lfmpexkq.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=juanjose.garciaripoll@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.