GNU bug report logs - #47895
28.0.50; Emacs should only animate images that are visible

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Mon, 19 Apr 2021 18:20:02 UTC

Severity: normal

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47895 <at> debbugs.gnu.org
Subject: bug#47895: 28.0.50; Emacs should only animate images that are visible
Date: Sun, 25 Apr 2021 21:07:48 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Hm...  No, even without the force-update, Emacs uses 100% CPU.
>
> Beware: changing that might make the timer run more frequently, so you
> might see CPU usage soar even though Emacs does almost nothing.

It's still updating at the same rate (25 times a second for the image in
question).

> We access a different frame of the GIF image, so that would mean
> regenerating the pixmap for the image, no?

It does, but why does that happen before redisplay has decided to
display the image?

>> I'd keep interpreting that the same -- that is, count down, even if the
>> image isn't displayed.
>
> But then if and when the image becomes visible, it won't show the
> animation, because it already reached the LIMIT.  Right?

Yes.  I think that's fine -- you've asked for X repetitions, and you get
X repetitions, whether it's shown or not.

>> Or just compute the position on each iteration -- the image may change
>> its position if more text is inserted, for instance.
>
> Sure, but even if the position doesn't change we currently cannot tell
> if the image is visible.  We have pos-visible-in-window-p, but that
> needs a buffer position -- which is why I suggest to record that
> position in the image.

Sure.  Could make it a marker, I guess.

>> But I'm still wondering about why this doesn't just work
>> "automatically" -- if we could handle this in the redisplay code, that
>> would be more natural.
>
> Animation doesn't work in redisplay, it works in this code I pointed
> to.

The code just alters some elements in the image plist.  It's unexpected
that this should lead to Emacs doing a lot of work -- unless it's
actually displaying the image.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.