Re: [Nautilus-list] Re: SVG Gorilla performance in nautilus ...



Hi Alex,

On Sun, 2002-02-24 at 00:15, Alex Larsson wrote:
> Not only is this expensive. It also means that the SVG icons are not 
> rendered at the "correct" size. Where correct means 100% should give icons 
> of size NAUTILUS_ICON_SIZE_STANDARD, e.g. 48x48.

	Sure.

> This does not happen, 
> instead the size depends on the size embedded in the svg file. You can see 
> this clearly when switching between gorilla and a non-svg theme.

	The size doesn't in fact depend on the svg file size - but rather
size->maximum_width / maximum_height - which is what the icon is scaled
to by scale_down_if_too_big - cf. revise_scale_factors_if_too_big.

> I looked at this a bit too, after your first mail, but I did the rsvg part 
> a bit different. I added a new function:
>
> GdkPixbuf  *
> rsvg_pixbuf_from_file_at_max_size (const gchar     *file_name,
> 				   gint             max_size,
> 				   GError         **error)
> 
> Which loads a svg and makes the max of width/height be max_size, and 
> scales keeping aspect ratio. I think this is more what you want here.

	Looks fine.

> Passing actual_size_in_pixels as the max_size argument seems to give me 
> icons that have the same size as the bitmapped ones. This seems like the 
> correct behaviour to me, although it makes gorilla have smaller icons 
> than when it currently has.

	Are you using emblems - I had some nasty issues with them, they appear
to render themselves around the maximum_size, which resulted in them
being rather horribly disjointed from the icons, and the layout looking
rather odd - perhaps some local tweak was causing me grief.

> My nautilus patch is just:
>
> diff -u -p -r1.255 nautilus-icon-factory.c
> --- nautilus-icon-factory.c     2002/02/21 19:26:46     1.255
> +++ nautilus-icon-factory.c     2002/02/24 00:01:14
> @@ -1383,7 +1383,7 @@ get_next_icon_size_to_try (guint target_
>  static GdkPixbuf *
>  load_pixbuf_svg (const char *path, guint size_in_pixels, gboolean 
> is_emblem)
>  {
> -       double actual_size_in_pixels, zoom;
> +       double actual_size_in_pixels;
>  
>         /* FIXME: the nominal size of .svg emblems is too large, so we scale it
>          * down here if the file is an emblem. This code should be removed
> @@ -1394,9 +1394,8 @@ load_pixbuf_svg (const char *path, guint
>         } else {
>                 actual_size_in_pixels = size_in_pixels;
>         }
> -       zoom = actual_size_in_pixels / NAUTILUS_ICON_SIZE_STANDARD;
> -
> -       return rsvg_pixbuf_from_file_at_zoom (path, zoom, zoom, NULL);
> +
> +       return rsvg_pixbuf_from_file_at_max_size (path, actual_size_in_pixels, NULL);
>  }
>
> Which seems to fix the emblem problem too.

	We should fix the scale factor for emblems there - there doens't seem
to be any particularly good reason for it to be precisely there in the
code.

> Hmmm. I don't seem to see in-icon text at all. Does it work for you?

	Yes - it'll need fixing, I can do that if you commit the above - but I
think we need a lot more clarity in the rational behind the maximum_size
vs. the requested size, and why they are so different and what is up
with the layout with emblems.

> Having a proportional specification of the embedded text rect seems like a 
> good idea. 

	Righty ho.

	Regards,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





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