diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2012-03-29 15:49:12 +0200 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2012-05-02 14:47:26 +0300 |
commit | 2e4b6052724d4e8a1aed2acc9ad97ec1e8c7642d (patch) | |
tree | fef6bb3c2a836b712099ac674e3a5d6814feba63 /common/rect.h | |
parent | f37ba0d032ed91fb3b624883a4309a9870a130dd (diff) | |
download | spice-common-2e4b6052724d4e8a1aed2acc9ad97ec1e8c7642d.tar.gz spice-common-2e4b6052724d4e8a1aed2acc9ad97ec1e8c7642d.tar.xz spice-common-2e4b6052724d4e8a1aed2acc9ad97ec1e8c7642d.zip |
rect: add rect_contains
Diffstat (limited to 'common/rect.h')
-rw-r--r-- | common/rect.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/rect.h b/common/rect.h index a63d785..655e9e8 100644 --- a/common/rect.h +++ b/common/rect.h @@ -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 |