rect: add rect_get_area

This commit is contained in:
Yonit Halperin 2012-04-08 14:20:55 +03:00
parent 2e4b605272
commit ffeb6ce677

View File

@ -80,6 +80,11 @@ static INLINE int rect_contains(const SpiceRect *big, const SpiceRect *small)
big->top <= small->top && big->bottom >= small->bottom;
}
static INLINE int rect_get_area(const SpiceRect *r)
{
return (r->right - r->left) * (r->bottom - r->top);
}
SPICE_END_DECLS
#ifdef __cplusplus
@ -124,6 +129,11 @@ static inline int rect_contains(const SpiceRect& big, const SpiceRect& small)
return rect_contains(&big, &small);
}
static inline int rect_get_area(const SpiceRect& r)
{
return rect_get_area(&r);
}
#endif /* __cplusplus */
#endif