Commit 6c76f8f6 authored by Alexander Larsson's avatar Alexander Larsson
Browse files

Add gdk_region_rect_equal to compare a region with a rect

parent 8a689f2e
......@@ -1581,6 +1581,32 @@ gdk_region_equal (const GdkRegion *region1,
return TRUE;
* gdk_region_rect_equal:
* @region: a #GdkRegion
* @rectangle: a #GdkRectangle
* Finds out if a regions is the same as a rectangle.
* Returns: %TRUE if @region and @rectangle are equal.
* Since: 2.18
gdk_region_rect_equal (const GdkRegion *region,
const GdkRectangle *rectangle)
g_return_val_if_fail (region != NULL, FALSE);
g_return_val_if_fail (rectangle != NULL, FALSE);
if (region->numRects != 1) return FALSE;
else if (region->extents.x1 != rectangle->x) return FALSE;
else if (region->extents.y1 != rectangle->y) return FALSE;
else if (region->extents.x2 != rectangle->x + rectangle->width) return FALSE;
else if (region->extents.y2 != rectangle->y + rectangle->height) return FALSE;
return TRUE;
* gdk_region_point_in:
* @region: a #GdkRegion
......@@ -77,6 +77,8 @@ void gdk_region_get_rectangles (const GdkRegion *region,
gboolean gdk_region_empty (const GdkRegion *region);
gboolean gdk_region_equal (const GdkRegion *region1,
const GdkRegion *region2);
gboolean gdk_region_rect_equal (const GdkRegion *region1,
const GdkRectangle *rectangle);
gboolean gdk_region_point_in (const GdkRegion *region,
int x,
int y);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment