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
This commit is contained in:
Matthias Clasen
2007-09-07 03:53:23 +00:00
committed by Matthias Clasen
parent 8e2de76673
commit 835c0a1510
2 changed files with 25 additions and 11 deletions

View File

@ -1,4 +1,14 @@
2007-09-06 Matthias Clasen <mclasen@redhat.com> 2007-09-06 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkrectangle.c (gdk_rectangle_intersect): Allow
dest to be NULL. (#464528, Xan Lopez)
2007-09-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkmisc.c (gtk_misc_set_alignment, gtk_misc_set_padding):
Actually emit change notification here. (#474282, Thomas Rydzynski)
2007-09-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserdefault.c (shortcuts_drop_uris): Initialize * gtk/gtkfilechooserdefault.c (shortcuts_drop_uris): Initialize
error to NULL before calling g_set_error(). Should fix #473954, error to NULL before calling g_set_error(). Should fix #473954,

View File

@ -62,12 +62,14 @@ gdk_rectangle_union (GdkRectangle *src1,
* gdk_rectangle_intersect: * gdk_rectangle_intersect:
* @src1: a #GdkRectangle * @src1: a #GdkRectangle
* @src2: 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 * Calculates the intersection of two rectangles. It is allowed for
* @dest to be the same as either @src1 or @src2. If the rectangles * @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 * do not intersect, @dest's width and height is set to 0 and its x
* and y values are undefined. * 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. * 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 (src1 != NULL, FALSE);
g_return_val_if_fail (src2 != NULL, FALSE); g_return_val_if_fail (src2 != NULL, FALSE);
g_return_val_if_fail (dest != NULL, FALSE);
return_val = FALSE; return_val = FALSE;
@ -93,13 +94,16 @@ gdk_rectangle_intersect (GdkRectangle *src1,
if (dest_w > 0 && dest_h > 0) if (dest_w > 0 && dest_h > 0)
{ {
dest->x = dest_x; if (dest)
dest->y = dest_y; {
dest->width = dest_w; dest->x = dest_x;
dest->height = dest_h; dest->y = dest_y;
dest->width = dest_w;
dest->height = dest_h;
}
return_val = TRUE; return_val = TRUE;
} }
else else if (dest)
{ {
dest->width = 0; dest->width = 0;
dest->height = 0; dest->height = 0;