Commit edc90a9f authored by Alexandre Julliard's avatar Alexandre Julliard

Added rect_in_region function.

parent 80bba3bd
......@@ -775,3 +775,20 @@ int point_in_region( struct region *region, int x, int y )
}
return 0;
}
/* check if the given rectangle is (at least partially) inside the region */
int rect_in_region( struct region *region, const rectangle_t *rect )
{
const rectangle_t *ptr, *end;
for (ptr = region->rects, end = region->rects + region->num_rects; ptr < end; ptr++)
{
if (ptr->top > rect->bottom) return 0;
if (ptr->bottom <= rect->top) continue;
/* now we are in the correct band */
if (ptr->left > rect->right) return 0;
if (ptr->right <= rect->left) continue;
return 1;
}
return 0;
}
......@@ -84,6 +84,7 @@ extern struct region *subtract_region( struct region *dst, const struct region *
extern struct region *union_region( struct region *dst, const struct region *src1,
const struct region *src2 );
extern int point_in_region( struct region *region, int x, int y );
extern int rect_in_region( struct region *region, const rectangle_t *rect );
static inline struct region *create_empty_region(void) { return create_region( NULL, 0 ); }
/* window functions */
......
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