mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
Add gdk_region_rect_equal to compare a region with a rect
This commit is contained in:
parent
8a689f2e15
commit
6c76f8f6ce
@ -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
|
||||
*/
|
||||
gboolean
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user