Try to use animation size in the loader for animations.

Pixbuf size can be innacurate for some animations with frames of
different sizes.

Fixes: NB#613595
parent 13440875
...@@ -321,21 +321,23 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, ...@@ -321,21 +321,23 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf,
gpointer loader) gpointer loader)
{ {
GdkPixbufLoaderPrivate *priv = GDK_PIXBUF_LOADER (loader)->priv; GdkPixbufLoaderPrivate *priv = GDK_PIXBUF_LOADER (loader)->priv;
gint width, height;
g_return_if_fail (pixbuf != NULL); g_return_if_fail (pixbuf != NULL);
width = anim ? gdk_pixbuf_animation_get_width (anim) :
gdk_pixbuf_get_width (pixbuf);
height = anim ? gdk_pixbuf_animation_get_height (anim) :
gdk_pixbuf_get_height (pixbuf);
if (!priv->size_fixed) if (!priv->size_fixed)
{ {
/* Defend against lazy loaders which don't call size_func */ /* Defend against lazy loaders which don't call size_func */
gint width = gdk_pixbuf_get_width (pixbuf);
gint height = gdk_pixbuf_get_height (pixbuf);
gdk_pixbuf_loader_size_func (&width, &height, loader); gdk_pixbuf_loader_size_func (&width, &height, loader);
} }
priv->needs_scale = FALSE; priv->needs_scale = FALSE;
if (priv->width > 0 && priv->height > 0 && if (priv->width > 0 && priv->height > 0 &&
(priv->width != gdk_pixbuf_get_width (pixbuf) || (priv->width != width || priv->height != height))
priv->height != gdk_pixbuf_get_height (pixbuf)))
priv->needs_scale = TRUE; priv->needs_scale = TRUE;
if (anim) if (anim)
...@@ -345,8 +347,8 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, ...@@ -345,8 +347,8 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf,
if (priv->needs_scale) { if (priv->needs_scale) {
priv->animation = GDK_PIXBUF_ANIMATION (_gdk_pixbuf_scaled_anim_new (anim, priv->animation = GDK_PIXBUF_ANIMATION (_gdk_pixbuf_scaled_anim_new (anim,
(double) priv->width / gdk_pixbuf_get_width (pixbuf), (double) priv->width / width,
(double) priv->height / gdk_pixbuf_get_height (pixbuf), (double) priv->height / height,
1.0)); 1.0));
g_object_unref (anim); g_object_unref (anim);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment