rect: add rect_contains

This commit is contained in:
Yonit Halperin 2012-03-29 15:49:12 +02:00
parent f37ba0d032
commit 2e4b605272

View File

@ -74,6 +74,12 @@ static INLINE int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2)
r1->bottom - r1->top == r2->bottom - r2->top;
}
static INLINE int rect_contains(const SpiceRect *big, const SpiceRect *small)
{
return big->left <= small->left && big->right >= small->right &&
big->top <= small->top && big->bottom >= small->bottom;
}
SPICE_END_DECLS
#ifdef __cplusplus
@ -113,6 +119,11 @@ static inline int rect_is_same_size(const SpiceRect& r1, const SpiceRect& r2)
return rect_is_same_size(&r1, &r2);
}
static inline int rect_contains(const SpiceRect& big, const SpiceRect& small)
{
return rect_contains(&big, &small);
}
#endif /* __cplusplus */
#endif