bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#47895: 28.0.50; Emacs should only animate images that are visible


From: Lars Ingebrigtsen
Subject: bug#47895: 28.0.50; Emacs should only animate images that are visible
Date: Sun, 25 Apr 2021 21:07:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@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





reply via email to

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