summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-04-08 14:20:55 +0300
committerYonit Halperin <yhalperi@redhat.com>2012-05-02 14:47:26 +0300
commitffeb6ce67735c59d90398e6e1fb47ad3022b7d5d (patch)
treec27534e7877a792e4c005c33fac7a2fa0026af16
parent2e4b6052724d4e8a1aed2acc9ad97ec1e8c7642d (diff)
rect: add rect_get_area
-rw-r--r--common/rect.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/rect.h b/common/rect.h
index 655e9e8..a9c1b08 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -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