diff options
Diffstat (limited to 'image.c')
-rw-r--r-- | image.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,4 +1,5 @@ #include "image.h" +#include "window.h" #include <gtk-3.0/gtk/gtk.h> GtkWidget *new_image() @@ -7,9 +8,8 @@ GtkWidget *new_image() return image; } -int load_image(char *file_name, int win_width, int win_height) +int load_image(char *file_name) { - printf("loading: %s\n", file_name); GError *error = NULL; if (pixbuf != NULL) g_object_unref(pixbuf); @@ -21,7 +21,7 @@ int load_image(char *file_name, int win_width, int win_height) gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); aspect_ratio = (double)pixbuf_width / (double)pixbuf_height; curr_zoom = 1.0; - fit_image(win_width, win_height); + fit_image(); return 1; } @@ -37,8 +37,11 @@ void update_pixbuf() gtk_image_set_from_pixbuf(GTK_IMAGE(image), GDK_PIXBUF(curr_pixbuf)); } -void fit_image(int win_width, int win_height) +void fit_image() { + gint win_width, win_height; + get_curr_win_size(&win_width, &win_height); + curr_scale_mod = fit; if (pixbuf == NULL || win_width < 1 || win_height < 1) return; if (win_width < pixbuf_width && win_height > pixbuf_height) { @@ -69,6 +72,7 @@ void fit_image(int win_width, int win_height) void zoom(int type) { + curr_scale_mod = zoomed; if (pixbuf == NULL) return; if (type == 0) { |