From 0089688d42f85b3e15a8897ce8ea22f6f33ec36e Mon Sep 17 00:00:00 2001 From: Padraig O'Briain Date: Mon, 20 Aug 2001 08:35:46 +0000 Subject: [PATCH] Swap height and width arguments to atk_image_get_image_size Swap height * docs/tmpl/atkimage.sgml atk/atkimage.h: Swap height and width arguments to atk_image_get_image_size * atk/atkimage.c: Swap height and height arguments to atk_image_get_image_size Do not crash if NULL pointers are passed for return values --- ChangeLog | 6 +++--- atk/atkimage.c | 50 +++++++++++++++++++++++++++++++++++-------------- atk/atkimage.h | 8 ++++---- docs/tmpl/atkimage.sgml | 2 +- 4 files changed, 44 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2cd8640..7a08c03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,8 @@ -2001-08-17 Padraig O'Briain +2001-08-20 Padraig O'Briain - * docs/tmpl/atkimage.sgml atk/atktext.h: + * docs/tmpl/atkimage.sgml atk/atkimage.h: Swap height and width arguments to atk_image_get_image_size - * atk/atktext.c: + * atk/atkimage.c: Swap height and height arguments to atk_image_get_image_size Do not crash if NULL pointers are passed for return values diff --git a/atk/atkimage.c b/atk/atkimage.c index 5a3000a..c8a719d 100755 --- a/atk/atkimage.c +++ b/atk/atkimage.c @@ -69,30 +69,43 @@ atk_image_get_image_description (AtkImage *image) /** * atk_image_get_image_size: * @image: a #GObject instance that implements AtkImageIface - * @height: filled with the image height * @width: filled with the image width + * @height: filled with the image height * - * Get the height and width in pixels for the specified image. - * The values of @height and @width are returned as -1 if the + * Get the wdith and height in pixels for the specified image. + * The values of @width and @height are returned as -1 if the * values cannot be obtained. **/ void -atk_image_get_image_size (AtkImage *image, int *height, int *width) +atk_image_get_image_size (AtkImage *image, + int *width, + int *height) { AtkImageIface *iface; + gint local_width, local_height; + gint *real_width, *real_height; g_return_if_fail (ATK_IS_IMAGE (image)); + if (width) + real_width = width; + else + real_width = &local_width; + if (height) + real_height = height; + else + real_height = &local_height; + iface = ATK_IMAGE_GET_IFACE (image); if (iface->get_image_size) { - iface->get_image_size (image, height, width); + iface->get_image_size (image, real_width, real_height); } else { - *height = -1; *width = -1; + *height = -1; } } @@ -108,7 +121,7 @@ atk_image_get_image_size (AtkImage *image, int *height, int *width) **/ gboolean atk_image_set_image_description (AtkImage *image, - const gchar *description) + const gchar *description) { AtkImageIface *iface; @@ -145,6 +158,21 @@ atk_image_get_image_position (AtkImage *image, AtkCoordType coord_type) { AtkImageIface *iface; + gint local_x, local_y; + gint *real_x, *real_y; + + g_return_if_fail (ATK_IS_IMAGE (image)); + + if (x) + real_x = x; + else + real_x = &local_x; + if (y) + real_y = y; + else + real_y = &local_y; + + iface = ATK_IMAGE_GET_IFACE (image); g_return_if_fail (ATK_IS_IMAGE (image)); @@ -152,7 +180,7 @@ atk_image_get_image_position (AtkImage *image, if (iface->get_image_position) { - (iface->get_image_position) (image, x, y, coord_type); + (iface->get_image_position) (image, real_x, real_y, coord_type); } else { @@ -160,9 +188,3 @@ atk_image_get_image_position (AtkImage *image, *y = -1; } } - - - - - - diff --git a/atk/atkimage.h b/atk/atkimage.h index 4e02c90..24e0b08 100755 --- a/atk/atkimage.h +++ b/atk/atkimage.h @@ -53,8 +53,8 @@ struct _AtkImageIface AtkCoordType coord_type); G_CONST_RETURN gchar* ( *get_image_description) (AtkImage *image); void ( *get_image_size) (AtkImage *image, - gint *height, - gint *width); + gint *width, + gint *height); gboolean ( *set_image_description) (AtkImage *image, const gchar *description); }; @@ -64,8 +64,8 @@ GType atk_image_get_type (void); G_CONST_RETURN gchar* atk_image_get_image_description (AtkImage *image); void atk_image_get_image_size (AtkImage *image, - gint *height, - gint *width); + gint *width, + gint *height); gboolean atk_image_set_image_description (AtkImage *image, const gchar *description); diff --git a/docs/tmpl/atkimage.sgml b/docs/tmpl/atkimage.sgml index 4a0bb76..8d0a6bc 100644 --- a/docs/tmpl/atkimage.sgml +++ b/docs/tmpl/atkimage.sgml @@ -69,7 +69,7 @@ an assistive technology to get descriptive information about images. @image: -@height: @width: +@height: -- 2.7.4