mirror of
https://github.com/labwc/labwc.git
synced 2026-02-10 04:27:47 -05:00
box: factor out box_center()
This commit is contained in:
parent
9f5ff391cc
commit
5ea617a393
3 changed files with 31 additions and 17 deletions
|
|
@ -10,6 +10,17 @@ bool box_intersects(struct wlr_box *box_a, struct wlr_box *box_b);
|
|||
void box_union(struct wlr_box *box_dest, struct wlr_box *box_a,
|
||||
struct wlr_box *box_b);
|
||||
|
||||
/*
|
||||
* Centers a content box (width & height) within a reference box,
|
||||
* limiting it (if possible) to not extend outside a bounding box.
|
||||
*
|
||||
* The reference box and bounding box are often the same but could be
|
||||
* different (e.g. when centering a view within its parent but limiting
|
||||
* to usable output area).
|
||||
*/
|
||||
void box_center(int width, int height, const struct wlr_box *ref,
|
||||
const struct wlr_box *bound, int *x, int *y);
|
||||
|
||||
/*
|
||||
* Fits and centers a content box (width & height) within a bounding box.
|
||||
* The content box is downscaled if necessary (preserving aspect ratio) but
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue