diff options
-rw-r--r-- | common/boxutil.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/boxutil.h b/common/boxutil.h index ae8d17b..55f725c 100644 --- a/common/boxutil.h +++ b/common/boxutil.h @@ -6,6 +6,24 @@ #include "miscstruct.h" #include "utils.h" +static inline void box_init(BoxPtr out, int x, int y, int w, int h) +{ + out->x1 = x; + out->x2 = x + w; + out->y1 = y; + out->y2 = y + h; +} + +static inline int box_width(const BoxRec *b) +{ + return b->x2 - b->x1; +} + +static inline int box_height(const BoxRec *b) +{ + return b->y2 - b->y1; +} + static inline Bool __box_intersect(BoxPtr out, const BoxRec *a, const BoxRec *b) { out->x1 = maxt(a->x1, b->x1); |