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: Eli Zaretskii
Subject: bug#67794: 30.0.50; mouse-face is not respected on SVG images
Date: Wed, 20 Dec 2023 15:19:29 +0200

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: alan@idiocy.org,  gerd.moellmann@gmail.com,  67794@debbugs.gnu.org
> Date: Wed, 20 Dec 2023 09:47:48 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> 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

Does it get bumped each hover-over, or does it stabilize after a few?

> > 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.

It would be a shame to waste cycles on PNG images as long as we don't
solve this problem, so I'd prefer to enable this only for SVG and
leave a FIXME comment about PNG.

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

Alan, is the trick with wrapping SVG with another one supposed to work
with all versions of librsvg?  I see some version conditions in
svg_load_image, but I'm not sure I understand the consequences.
Specifically, what does this code do:

  #if LIBRSVG_CHECK_VERSION (2, 48, 0)
    rsvg_handle_set_stylesheet (rsvg_handle, (guint8 *)css, strlen (css), NULL);
  #endif

It is only used for librsvg 2.48 and later.

And for librsvg older than 2.32, it looks like we don't use the
wrapped SVG at all?





reply via email to

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