summaryrefslogtreecommitdiff
path: root/siv.c
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2008-03-08 17:49:55 -0500
committerSøren Sandmann <sandmann@redhat.com>2008-03-08 17:49:55 -0500
commitba16ddcb5821f09273356115ebe98f2a2f413591 (patch)
treec77d05750c529522875df9676e0ef4a3cbbb96c2 /siv.c
parent987c005c00489eb5515ee1e238d1588a1523631c (diff)
Fix expose
Diffstat (limited to 'siv.c')
-rw-r--r--siv.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/siv.c b/siv.c
index c4c4852..0751bd5 100644
--- a/siv.c
+++ b/siv.c
@@ -116,18 +116,17 @@ on_expose (GtkWidget *drawing_area, GdkEventExpose *expose, Application *app)
image.x = image.y = 0;
compute_size (app, &image.width, &image.height);
- if (!gdk_rectangle_intersect (&(expose->area), &image, &dest))
- return TRUE;
-
- win_x = dest.x;
- win_y = dest.y;
-
if (image.width < window_width)
- win_x = (window_width - image.width) / 2;
+ image.x = (window_width - image.width) / 2;
if (image.height < window_height)
- win_y = (window_height - image.height) / 2;
+ image.y = (window_height - image.height) / 2;
+
+ if (!gdk_rectangle_intersect (&(expose->area), &image, &dest))
+ return TRUE;
+ g_print ("dest: %d %d %d %d\n", dest.x, dest.y, dest.width, dest.height);
+
/* We create a temporary pixbuf without alpha (since X is generally worthless) */
if (gtk_check_menu_item_get_active (GET_WIDGET (app, "menu_no")))
has_alpha = TRUE;
@@ -160,16 +159,17 @@ on_expose (GtkWidget *drawing_area, GdkEventExpose *expose, Application *app)
interp = GDK_INTERP_BILINEAR;
else
interp = GDK_INTERP_NEAREST;
-
+
+ g_print ("dest: %d %d\n", dest.x, dest.y);
gdk_pixbuf_composite (app->original, tmp,
0, 0, dest.width, dest.height,
- - dest.x, - dest.y,
+ -(dest.x - image.x), -(dest.y - image.y),
get_scale (app), get_scale (app),
interp, 0xFF);
g_print ("asdf\n");
gdk_draw_pixbuf (drawing_area->window, NULL,
- tmp, 0, 0, win_x, win_y, dest.width, dest.height, GDK_RGB_DITHER_NONE, 0, 0);
+ tmp, 0, 0, dest.x, dest.y, dest.width, dest.height, GDK_RGB_DITHER_NONE, 0, 0);
g_object_unref (tmp);