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

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

bug#67794: 30.0.50; mouse-face is not respected on SVG images


From: Manuel Giraud
Subject: bug#67794: 30.0.50; mouse-face is not respected on SVG images
Date: Wed, 20 Dec 2023 09:47:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

[...]

>> > Depending on your system, there surely is some tools which show the
>> > memory map of a given process in some graphical manner.
>> >
>> > If worse comes to worst, you could use 'top' of "M-x proced" in
>> > another Emacs, although that will only show a single figure or two.
>> 
>> Ok, I thought you were thinking of something into Emacs.  I'll try to do
>> something like this.
>
> Thanks.

So with "ps", I measured the RSS (resident set, here in KB).  I start
from "emacs -Q" with this patch.  I used the following code to test the
feature (the SVG used here is 580x580 pixels so produces a quite large
image on display):
--8<---------------cut here---------------start------------->8---
(defun +insert-stuff ()
  (interactive)
  (let ((str "foobar"))
    (add-text-properties 0 1
                         (list 'display
                               (find-image
                                '((:type xpm :file "close.xpm" :ascent center))
                                t))
                         str)
    (add-text-properties 3 4
                         (list 'display
                               (find-image
                                '((:type svg :file 
"/usr/local/share/qgis/svg/tourist/tourist_fountain.svg"))
                                t))
                         str)
    (add-text-properties 0 6
                         (list 'mouse-face '(:background "red" :foreground 
"blue")) str)
    (insert str)))
--8<---------------cut here---------------end--------------->8---

Here are the results:

Right after "emacs -Q": rss = 44688
After 'M-x +insert-stuff': rss = 54292
After first hover on text: rss = 54464
After repeated hover on/off text: rss = 54496

> Btw, does this only work for SVG, and if librsvg is later than some
> recent version?  Or does this work with any image?  If the former,
> this code should be executed only conditionally, under those
> conditions under which it really changes the background color of an
> image.

You're right: it does only work with SVG.  XPM are already handled with
mask.  I have tested and it does not work with PNG with transparent
background: don't know why.  Maybe instead of guard it with a "only for
SVG" test, we should resolve the issue for transparent PNG at a later
time.

I'm using librsvg 2.57 and I could not easily test it with an older
version.
-- 
Manuel Giraud





reply via email to

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