From 91a89808f1f9a19c6703706f1859c870b9884d05 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 9 Jan 2010 01:27:29 +0100 Subject: 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(). --- window_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'window_main.c') 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(); } -- cgit v1.2.3