From 2a0863af09f06b2693ecbb527c3cd8012b9f2b67 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 22 Jul 2003 12:49:49 +0000 Subject: [PATCH] Some more clipping_rects methods, based on BRects methods. Currently unused, but could be used in the Game Kit and, why not, also in the app server itself. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4053 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/interface/clipping.h | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/headers/private/interface/clipping.h b/headers/private/interface/clipping.h index a4f5e33eae..65ee86c91a 100644 --- a/headers/private/interface/clipping.h +++ b/headers/private/interface/clipping.h @@ -1,6 +1,17 @@ #ifndef __CLIPPING_H #define __CLIPPING_H +#include +#include + + +/* Some methods to manipulate clipping_rects. + basically you can do almost everything you do with + BRects, just that clipping_rects can only have integer + coordinates (a thing that makes these perfect for drawing + calculations). +*/ + static inline clipping_rect union_rect(clipping_rect r1, clipping_rect r2) { @@ -81,4 +92,26 @@ valid_rect(clipping_rect rect) return false; } + +static inline bool +rects_intersects(clipping_rect rectA, clipping_rect rectB) +{ + return valid_rect(sect_rect(rectA, rectB)); +} + + +static inline int32 +rect_width(clipping_rect rect) +{ + return rect.right - rect.left; +} + + +static inline int32 +rect_height(clipping_rect rect) +{ + return rect.bottom - rect.top; +} + + #endif // __CLIPPING_H