diff options
author | Matthias Clasen <mclasen@redhat.com> | 2007-09-07 03:53:23 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2007-09-07 03:53:23 +0000 |
commit | 835c0a1510dcd9a2777df0cfe126d03e44ed9789 (patch) | |
tree | 9937314db76c72004f36c5b00eb1480eb77ecfe5 /gdk/gdkrectangle.c | |
parent | 8e2de7667315d782bd5073480d95c5b8c387b29e (diff) | |
download | gtk+-835c0a1510dcd9a2777df0cfe126d03e44ed9789.tar.gz |
Allow dest to be NULL. (#464528, Xan Lopez)
2007-09-06 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkrectangle.c (gdk_rectangle_intersect): Allow
dest to be NULL. (#464528, Xan Lopez)
svn path=/trunk/; revision=18742
Diffstat (limited to 'gdk/gdkrectangle.c')
-rw-r--r-- | gdk/gdkrectangle.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gdk/gdkrectangle.c b/gdk/gdkrectangle.c index 71679f98f7..c5e9dfcc37 100644 --- a/gdk/gdkrectangle.c +++ b/gdk/gdkrectangle.c @@ -62,12 +62,14 @@ gdk_rectangle_union (GdkRectangle *src1, * gdk_rectangle_intersect: * @src1: a #GdkRectangle * @src2: a #GdkRectangle - * @dest: return location for the intersection of @src1 and @src2 + * @dest: return location for the intersection of @src1 and @src2, or %NULL * * Calculates the intersection of two rectangles. It is allowed for - * @dest to be the same as either @src1 or @src2. If the rectangles - * doesn't intersect, @dest's width and height is set to 0 and its x - * and y values are undefined. + * @dest to be the same as either @src1 or @src2. If the rectangles + * do not intersect, @dest's width and height is set to 0 and its x + * and y values are undefined. If you are only interested in whether + * the rectangles intersect, but not in the intersecting area itself, + * pass %NULL for @dest. * * Returns: %TRUE if the rectangles intersect. */ @@ -82,7 +84,6 @@ gdk_rectangle_intersect (GdkRectangle *src1, g_return_val_if_fail (src1 != NULL, FALSE); g_return_val_if_fail (src2 != NULL, FALSE); - g_return_val_if_fail (dest != NULL, FALSE); return_val = FALSE; @@ -93,13 +94,16 @@ gdk_rectangle_intersect (GdkRectangle *src1, if (dest_w > 0 && dest_h > 0) { - dest->x = dest_x; - dest->y = dest_y; - dest->width = dest_w; - dest->height = dest_h; + if (dest) + { + dest->x = dest_x; + dest->y = dest_y; + dest->width = dest_w; + dest->height = dest_h; + } return_val = TRUE; } - else + else if (dest) { dest->width = 0; dest->height = 0; |