4 /** A rectangular part of a drawing surface, such as the screen. */
14 is_in_box(struct box
*box
, int x
, int y
)
16 return (x
>= box
->x
&& y
>= box
->y
17 && x
< box
->x
+ box
->width
18 && y
< box
->y
+ box
->height
);
23 row_is_in_box(struct box
*box
, int y
)
25 return (y
>= box
->y
&& y
< box
->y
+ box
->height
);
30 col_is_in_box(struct box
*box
, int x
)
32 return (x
>= box
->x
&& x
< box
->x
+ box
->width
);
35 /** Check whether a span of columns is in @a box.
36 * Mainly intended for use with double-width characters.
39 colspan_is_in_box(struct box
*box
, int x
, int span
)
41 return (x
>= box
->x
&& x
+ span
<= box
->x
+ box
->width
);
47 set_box(struct box
*box
, int x
, int y
, int width
, int height
)
49 box
->x
= int_max(0, x
);
50 box
->y
= int_max(0, y
);
51 box
->width
= int_max(0, width
);
52 box
->height
= int_max(0, height
);
57 copy_box(struct box
*dst
, struct box
*src
)
59 copy_struct(dst
, src
);
62 #define dbg_show_box(box) DBG("x=%i y=%i width=%i height=%i", (box)->x, (box)->y, (box)->width, (box)->height)
63 #define dbg_show_xy(x_, y_) DBG("x=%i y=%i", x_, y_)