From c863ad0fc23a1c1c255ec4b403f0ce96d26e893f Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 25 May 2005 11:49:54 +0000 Subject: [PATCH] correctly handle very small target sizes. 2005-05-25 Sven Neumann * libgimpwidgets/gimpoffsetarea.c (gimp_offset_area_expose_event): correctly handle very small target sizes. --- ChangeLog | 5 +++++ libgimpwidgets/gimpoffsetarea.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f83927d67..a299fa37a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-05-25 Sven Neumann + + * libgimpwidgets/gimpoffsetarea.c (gimp_offset_area_expose_event): + correctly handle very small target sizes. + 2005-05-25 Sven Neumann * app/widgets/gimpclipboard.[ch]: fixed gtk-doc comments. diff --git a/libgimpwidgets/gimpoffsetarea.c b/libgimpwidgets/gimpoffsetarea.c index c186804af1..52888e04be 100644 --- a/libgimpwidgets/gimpoffsetarea.c +++ b/libgimpwidgets/gimpoffsetarea.c @@ -461,17 +461,24 @@ gimp_offset_area_expose_event (GtkWidget *widget, h = widget->allocation.height + 2; } + w = MAX (w, 1); + h = MAX (h, 1); + if (pixbuf) { - GdkGC *gc = gdk_gc_new (widget->window); + GdkGC *gc = gdk_gc_new (widget->window); + gint line = MIN (3, MIN (w, h)); gdk_gc_set_function (gc, GDK_INVERT); - gdk_gc_set_line_attributes (gc, 3, + gdk_gc_set_line_attributes (gc, line, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_ROUND); gdk_draw_rectangle (widget->window, gc, FALSE, - x + 1, y + 1, w - 3, h - 3); + x + line / 2, + y + line / 2, + MAX (w - line, 1), + MAX (h - line, 1)); g_object_unref (gc); }