aboutsummaryrefslogtreecommitdiff
path: root/src/imageview.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-04-28 08:00:26 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-04-28 08:00:26 +0000
commited8225270aa79262e1c29519a62a7faede6c4dbe (patch)
tree9cca8f1b6f96c30b9d1e83fde08db80a42e3f825 /src/imageview.c
parent5c9d94e0a86d35a219daa154838327b2af119734 (diff)
suppressed unrequired image scaling.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@233 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/imageview.c')
-rw-r--r--src/imageview.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/imageview.c b/src/imageview.c
index 2f664dc8..bbe14c9e 100644
--- a/src/imageview.c
+++ b/src/imageview.c
@@ -33,7 +33,7 @@
#include "imageview.h"
#include "utils.h"
-static void get_resized_size (gint w,
+static gboolean get_resized_size(gint w,
gint h,
gint aw,
gint ah,
@@ -169,17 +169,19 @@ GdkPixbuf *imageview_get_resized_pixbuf(GdkPixbuf *pixbuf, GtkWidget *parent,
if (avail_width > margin) avail_width -= margin;
if (avail_height > margin) avail_height -= margin;
- get_resized_size(gdk_pixbuf_get_width(pixbuf),
- gdk_pixbuf_get_height(pixbuf),
- avail_width, avail_height,
- &new_width, &new_height);
+ if (get_resized_size(gdk_pixbuf_get_width(pixbuf),
+ gdk_pixbuf_get_height(pixbuf),
+ avail_width, avail_height,
+ &new_width, &new_height))
+ return gdk_pixbuf_scale_simple
+ (pixbuf, new_width, new_height, GDK_INTERP_BILINEAR);
- return gdk_pixbuf_scale_simple
- (pixbuf, new_width, new_height, GDK_INTERP_BILINEAR);
+ g_object_ref(pixbuf);
+ return pixbuf;
}
-static void get_resized_size(gint w, gint h, gint aw, gint ah,
- gint *sw, gint *sh)
+static gboolean get_resized_size(gint w, gint h, gint aw, gint ah,
+ gint *sw, gint *sh)
{
gfloat wratio = 1.0;
gfloat hratio = 1.0;
@@ -188,7 +190,7 @@ static void get_resized_size(gint w, gint h, gint aw, gint ah,
if (w <= aw && h <= ah) {
*sw = w;
*sh = h;
- return;
+ return FALSE;
}
if (w > aw)
@@ -214,6 +216,8 @@ static void get_resized_size(gint w, gint h, gint aw, gint ah,
*sh = (gint)(h * ratio);
}
}
+
+ return TRUE;
}
static gint button_press_cb(GtkWidget *widget, GdkEventButton *event,