[gtk+] iconhelper: Move size computation
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] iconhelper: Move size computation
- Date: Tue, 1 Dec 2015 23:30:30 +0000 (UTC)
commit 071d2a1d69c5bad3d6d4b451a9f7568fbf2507a8
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 27 18:05:36 2015 +0100
iconhelper: Move size computation
We do a switch on the image type, so compute the size for a certain
image type right there.
gtk/gtkiconhelper.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index f71c464..d4b5aa0 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -867,6 +867,14 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
height = (height + scale - 1) / scale;
break;
+ case GTK_IMAGE_ANIMATION:
+ {
+ GdkPixbufAnimation *animation = gtk_image_definition_get_animation (self->priv->def);
+ width = gdk_pixbuf_animation_get_width (animation);
+ height = gdk_pixbuf_animation_get_height (animation);
+ break;
+ }
+
case GTK_IMAGE_ICON_NAME:
case GTK_IMAGE_GICON:
if (self->priv->pixel_size != -1 || self->priv->force_scale_pixbuf)
@@ -876,7 +884,6 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
case GTK_IMAGE_STOCK:
case GTK_IMAGE_ICON_SET:
- case GTK_IMAGE_ANIMATION:
case GTK_IMAGE_EMPTY:
default:
break;
@@ -893,12 +900,6 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
height = self->priv->rendered_surface_height;
cairo_surface_destroy (surface);
}
- else if (gtk_image_definition_get_storage_type (self->priv->def) == GTK_IMAGE_ANIMATION)
- {
- GdkPixbufAnimation *animation = gtk_image_definition_get_animation (self->priv->def);
- width = gdk_pixbuf_animation_get_width (animation);
- height = gdk_pixbuf_animation_get_height (animation);
- }
else if (self->priv->icon_size != GTK_ICON_SIZE_INVALID)
{
ensure_icon_size (self, &width, &height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]