Subject: bug#59075: 29.0.50; Image transforms not applied to svg images

From: Po Lu <[email-masked]>
Date: Mon, 07 Nov 2022 20:24:05 +0800

Evgeny Zajcev <[email-masked]> writes:

> пн, 7 нояб. 2022 г. в 03:26, Po Lu <[email-masked]>:
>
>  My suspicion is that librsvg is not being used to display SVGs at all,
>  on Mac OS 13.  What happens if you build without native image APIs?
>
> Works perfectly without native image API!  Resulting svg image gets correct size after applying `:height',
> and if I change image type to png, image is not displayed at all as expected.

Scratch what I said earlier.  Does this fix the problem?

diff --git a/src/nsimage.m b/src/nsimage.m
index 9cb5090dd0..dd8768664a 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -74,8 +74,10 @@ Updated by Christian Limpach ([email-masked])
     imageType = @"com.compuserve.gif";
   else if (EQ (type, Qtiff))
     imageType = @"public.tiff";
+#ifndef HAVE_RSVG
   else if (EQ (type, Qsvg))
     imageType = @"public.svg-image";
+#endif
   else if (EQ (type, Qheic))
     imageType = @"public.heic";

If rsvg is present, there is no point in using native image APIs, as
they do not scale SVG images nearly as well.  And this part of
image_set_transform gets in the way:

#ifdef HAVE_RSVG
  /* SVGs are pre-scaled to the correct size.  */
  if (EQ (image_spec_value (img->spec, QCtype, NULL), Qsvg))
    {
      width = img->width / FRAME_SCALE_FACTOR (f);
      height = img->height / FRAME_SCALE_FACTOR (f);
    }
  else
#endif