util/box: introduce wlr_fbox_empty

Same as wlr_box_empty, but for wlr_fbox.
master
Simon Ser 3 years ago committed by Simon Zeni
parent 7939bf8cc6
commit fdc22449d6

@ -78,9 +78,17 @@ bool wlr_box_empty(const struct wlr_box *box);
void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
enum wl_output_transform transform, int width, int height);
/**
* Checks whether a box is empty or not.
*
* A wlr_box is considered empty if its width and/or height is zero or negative.
*/
bool wlr_fbox_empty(const struct wlr_fbox *box);
/**
* Transforms a floating-point box inside a (0, 0, width, height) box.
*/
void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
enum wl_output_transform transform, double width, double height);
#endif

@ -120,6 +120,10 @@ void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
}
}
bool wlr_fbox_empty(const struct wlr_fbox *box) {
return box == NULL || box->width <= 0 || box->height <= 0;
}
void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
enum wl_output_transform transform, double width, double height) {
struct wlr_fbox src = *box;

Loading…
Cancel
Save