[gdk-pixbuf] Try to use animation size in the loader for animations.
- From: Xabier Rodriguez Calvar <xrcalvar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] Try to use animation size in the loader for animations.
- Date: Mon, 30 Jul 2012 11:25:39 +0000 (UTC)
commit c62676a2843f391f32df2636d738e6333ae0318d
Author: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Mon Mar 22 15:33:54 2010 +0100
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
gdk-pixbuf/gdk-pixbuf-loader.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index c2d2d90..8f46deb 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]