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

Yonit Halperin yhalperi at redhat.com
Tue Apr 17 03:12:11 PDT 2012


---
 common/rect.h |   10 ++++++++++
 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
-- 
1.7.7.6



More information about the Spice-devel mailing list