[gnome-shell] texture-cache: always call gdk_pixbuf_loader_set_size
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] texture-cache: always call gdk_pixbuf_loader_set_size
- Date: Fri, 28 Mar 2014 17:53:25 +0000 (UTC)
commit 90e52d7266fc8e8a71d7339e6d69870762a1c7e2
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Mar 22 20:26:09 2014 -0700
texture-cache: always call gdk_pixbuf_loader_set_size
Just use the regular image size if we don't want to scale it. This is a
refactor in preparation for the next commit.
https://bugzilla.gnome.org/show_bug.cgi?id=726907
src/st/st-texture-cache.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 2a0036d..c194ec5 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -178,7 +178,7 @@ st_texture_cache_finalize (GObject *object)
G_OBJECT_CLASS (st_texture_cache_parent_class)->finalize (object);
}
-static gboolean
+static void
compute_pixbuf_scale (gint width,
gint height,
gint available_width,
@@ -189,7 +189,10 @@ compute_pixbuf_scale (gint width,
int scaled_width, scaled_height;
if (width == 0 || height == 0)
- return FALSE;
+ {
+ *new_width = *new_height = 0;
+ return;
+ }
if (available_width >= 0 && available_height >= 0)
{
@@ -225,9 +228,12 @@ compute_pixbuf_scale (gint width,
{
*new_width = scaled_width;
*new_height = scaled_height;
- return TRUE;
}
- return FALSE;
+ else
+ {
+ *new_width = width;
+ *new_height = height;
+ }
}
static void
@@ -314,9 +320,12 @@ on_image_size_prepared (GdkPixbufLoader *pixbuf_loader,
int scaled_width;
int scaled_height;
- if (compute_pixbuf_scale (width, height, available_width, available_height,
- &scaled_width, &scaled_height))
- gdk_pixbuf_loader_set_size (pixbuf_loader, scaled_width, scaled_height);
+ compute_pixbuf_scale (width, height, available_width, available_height,
+ &scaled_width, &scaled_height);
+
+ gdk_pixbuf_loader_set_size (pixbuf_loader,
+ scaled_width,
+ scaled_height);
}
static GdkPixbuf *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]