diff options
author | Simon Glass <sjg@chromium.org> | 2023-10-01 19:13:29 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-11 15:43:55 -0400 |
commit | 8bc69b4b247f45cdfca18e942bf5a5995265479a (patch) | |
tree | 5167d311ea46c5d7eb5edcc4bf48d0b7e39c5086 /boot/scene_menu.c | |
parent | 117617c7c1d8f82304e019e5a2c7f1c23f78da8f (diff) |
expo: Make calculation of an object bounding box generic
We want to support this for any object, not just menus. Move the code
around to allow this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/scene_menu.c')
-rw-r--r-- | boot/scene_menu.c | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/boot/scene_menu.c b/boot/scene_menu.c index e0dcd0a4e04..95c283af4b0 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -114,42 +114,9 @@ static void menu_point_to_item(struct scene_obj_menu *menu, uint item_id) update_pointers(menu, item_id, true); } -static int scene_bbox_union(struct scene *scn, uint id, int inset, - struct vidconsole_bbox *bbox) -{ - struct scene_obj *obj; - - if (!id) - return 0; - obj = scene_obj_find(scn, id, SCENEOBJT_NONE); - if (!obj) - return log_msg_ret("obj", -ENOENT); - if (bbox->valid) { - bbox->x0 = min(bbox->x0, obj->dim.x - inset); - bbox->y0 = min(bbox->y0, obj->dim.y); - bbox->x1 = max(bbox->x1, obj->dim.x + obj->dim.w + inset); - bbox->y1 = max(bbox->y1, obj->dim.y + obj->dim.h); - } else { - bbox->x0 = obj->dim.x - inset; - bbox->y0 = obj->dim.y; - bbox->x1 = obj->dim.x + obj->dim.w + inset; - bbox->y1 = obj->dim.y + obj->dim.h; - bbox->valid = true; - } - - return 0; -} - -/** - * scene_menu_calc_bbox() - Calculate bounding boxes for the menu - * - * @menu: Menu to process - * @bbox: Returns bounding box of menu including prompts - * @label_bbox: Returns bounding box of labels - */ -static void scene_menu_calc_bbox(struct scene_obj_menu *menu, - struct vidconsole_bbox *bbox, - struct vidconsole_bbox *label_bbox) +void scene_menu_calc_bbox(struct scene_obj_menu *menu, + struct vidconsole_bbox *bbox, + struct vidconsole_bbox *label_bbox) { const struct expo_theme *theme = &menu->obj.scene->expo->theme; const struct scene_menitem *item; |