[Spice-devel] [PATCH spice-common 2/6] rect: add rect_get_area

Yonit Halperin yhalperi at redhat.com
Sun Apr 8 08:42:34 PDT 2012


Signed-off-by: Yonit Halperin <yhalperi at redhat.com>
---
 common/rect.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/common/rect.h b/common/rect.h
index 655e9e8..0e4b01e 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_contains(&r);
+}
+
 #endif /* __cplusplus */
 
 #endif
-- 
1.7.7.6



More information about the Spice-devel mailing list