diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-12-27 21:42:02 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-12-27 21:42:02 +0000 |
commit | 6d51fcd95ac41a3d9c003d2e10f307c563690816 (patch) | |
tree | 66c2f1b1dc361e9011ccbffb8f98c2da427dcdd5 /gtk/gtkimage.c | |
parent | 7aeb18a51ce57f538a2af9a6e53413bc665d7616 (diff) | |
download | gdk-pixbuf-6d51fcd95ac41a3d9c003d2e10f307c563690816.tar.gz |
Make interpretation of misc->xpad/ypad consistent with GtkLabel. Do
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
of misc->xpad/ypad consistent with GtkLabel. Do
directional flipping when interpreting misc->xalign/yalign.
Fix off-by-one error for negative x,y. (#67472, reported
by Mathieu Lacage)
Diffstat (limited to 'gtk/gtkimage.c')
-rw-r--r-- | gtk/gtkimage.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 7c8bebc5b..d601ed15c 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -24,6 +24,7 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#include <math.h> #include "gtkcontainer.h" #include "gtkimage.h" #include "gtkiconfactory.h" @@ -1202,6 +1203,7 @@ gtk_image_expose (GtkWidget *widget, GtkImage *image; GtkMisc *misc; GdkRectangle area, image_bound; + gfloat xalign; gint x, y; GdkBitmap *mask = NULL; GdkPixbuf *stock_pixbuf = NULL; @@ -1209,15 +1211,18 @@ gtk_image_expose (GtkWidget *widget, image = GTK_IMAGE (widget); misc = GTK_MISC (widget); - x = (widget->allocation.x * (1.0 - misc->xalign) + - (widget->allocation.x + widget->allocation.width - - (widget->requisition.width - misc->xpad * 2)) * - misc->xalign) + 0.5; - y = (widget->allocation.y * (1.0 - misc->yalign) + - (widget->allocation.y + widget->allocation.height - - (widget->requisition.height - misc->ypad * 2)) * - misc->yalign) + 0.5; - + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) + xalign = misc->xalign; + else + xalign = 1.0 - misc->xalign; + + x = floor (widget->allocation.x + misc->xpad + + ((widget->allocation.width - widget->requisition.width) * xalign) + + 0.5); + y = floor (widget->allocation.y + misc->ypad + + ((widget->allocation.height - widget->requisition.height) * misc->yalign) + + 0.5); + image_bound.x = x; image_bound.y = y; |