summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf-loader.c
diff options
context:
space:
mode:
authorXabier Rodriguez Calvar <xrcalvar@igalia.com>2010-03-22 15:33:54 +0100
committerXabier Rodriguez Calvar <xrcalvar@igalia.com>2012-07-30 11:23:09 +0200
commitc62676a2843f391f32df2636d738e6333ae0318d (patch)
tree3dab99d69cd9673ed6c089f7c65e3b489302d5f2 /gdk-pixbuf/gdk-pixbuf-loader.c
parent134408750f9dd209204abd54f1749f3cc293534e (diff)
downloadgdk-pixbuf-c62676a2843f391f32df2636d738e6333ae0318d.tar.gz
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
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf-loader.c')
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index c2d2d90a0..8f46deb0d 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ b/gdk-pixbuf/gdk-pixbuf-loader.c
@@ -321,21 +321,23 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf,
gpointer loader)
{
GdkPixbufLoaderPrivate *priv = GDK_PIXBUF_LOADER (loader)->priv;
+ gint width, height;
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)
{
/* 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);
}
priv->needs_scale = FALSE;
if (priv->width > 0 && priv->height > 0 &&
- (priv->width != gdk_pixbuf_get_width (pixbuf) ||
- priv->height != gdk_pixbuf_get_height (pixbuf)))
+ (priv->width != width || priv->height != height))
priv->needs_scale = TRUE;
if (anim)
@@ -345,8 +347,8 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf,
if (priv->needs_scale) {
priv->animation = GDK_PIXBUF_ANIMATION (_gdk_pixbuf_scaled_anim_new (anim,
- (double) priv->width / gdk_pixbuf_get_width (pixbuf),
- (double) priv->height / gdk_pixbuf_get_height (pixbuf),
+ (double) priv->width / width,
+ (double) priv->height / height,
1.0));
g_object_unref (anim);
}