aboutsummaryrefslogtreecommitdiff
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
parent5c9d94e0a86d35a219daa154838327b2af119734 (diff)
suppressed unrequired image scaling.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@233 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja5
-rw-r--r--src/imageview.c24
3 files changed, 24 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d39e66c..35b51114 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-04-27
+ * src/imageview.c: imageview_get_resized_pixbuf(): don't scale images
+ if not required (just increase ref count).
+
+2005-04-27
+
* src/mainwindow.c: main_window_create(): disable no longer required
workaround for resize grip on GTK+ 2.6.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 6981f6d6..1a91ee94 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,10 @@
2005-04-27
+ * src/imageview.c: imageview_get_resized_pixbuf(): 必要ない場合画像を
+ スケールしないようにした(単に参照カウントを増加)。
+
+2005-04-27
+
* src/mainwindow.c: main_window_create(): GTK+ 2.6 では不要なリサイズ
グリップのための対処を無効にした。
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,