diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-01-09 01:27:29 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-01-09 01:27:29 +0100 |
commit | 91a89808f1f9a19c6703706f1859c870b9884d05 (patch) | |
tree | 13483c15d505c2ebe2b5a02c8ba5f5b847e5c43e /window_main.c | |
parent | acacdcd8521c29f1a2c893d4bf97445cb22a9e75 (diff) |
Store original pixbufs so that preloaded images can be properly resized.
load_pixbuf() will now load the original pixbuf, then draw the
pre-resized pixbuf (if any) while keeping the original loaded.
This way the image will be properly resized when needed.
Added mutex calls to preload_clear().
Diffstat (limited to 'window_main.c')
-rw-r--r-- | window_main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/window_main.c b/window_main.c index 41f53ad..a4e84f1 100644 --- a/window_main.c +++ b/window_main.c @@ -147,7 +147,7 @@ static void set_image_pixbuf() { void on_window_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) { if(orig_pixbuf && (allocation->width != last_width || allocation->height != last_height)) { - preload_clear(); + preload_clear_sized(); set_image_pixbuf(); last_width = allocation->width; last_height = allocation->height; @@ -160,7 +160,7 @@ static gboolean hpane_resize_idle_func(gpointer data) { pos = gtk_paned_get_position(GTK_PANED(data)); if(pos != hpane_last_pos) { - preload_clear(); + preload_clear_sized(); set_image_pixbuf(); hpane_last_pos = pos; return TRUE; /* Ensure that we'll keep checking until we're done resizing. */ @@ -203,7 +203,7 @@ static void load_pixbuf(const gchar *filepath) { pt = preload_get(filepath); if(pt) - orig_pixbuf = gdk_pixbuf_copy(pt->pb); + orig_pixbuf = gdk_pixbuf_copy(pt->pb_orig); else orig_pixbuf = NULL; @@ -243,11 +243,11 @@ static void load_pixbuf(const gchar *filepath) { walls_set_window_title(); } - if(pt) { + if(pt && pt->pb) { window = gtk_widget_get_window(layout); gdk_drawable_get_size(window, &win_width, &win_height); - set_image_pixbuf_resized(orig_pixbuf, win_width, win_height, pt->width, pt->height, pt->ratio); + set_image_pixbuf_resized(pt->pb, win_width, win_height, pt->width, pt->height, pt->ratio); } else set_image_pixbuf(); } |