diff options
| author | Simon Glass <[email protected]> | 2025-05-02 08:46:35 -0600 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-30 09:49:32 +0100 |
| commit | e3c3f83cb6ce85ef541359fa46fd802e1b53494b (patch) | |
| tree | f2f267f113099d89950b5bf17cdc8f306c076e2f /boot | |
| parent | baaf0907345558db58982445579e7d445ee60f21 (diff) | |
expo: Support setting the size and bounds of an object
Add a function to allow the size of an object to be set independently
of its position.
Also add a function to permit the object's bounding box to be set
independently of its dimensions.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/scene.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/boot/scene.c b/boot/scene.c index f1dc2d81922..ea329252d28 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -235,6 +235,35 @@ int scene_obj_set_size(struct scene *scn, uint id, int w, int h) return 0; } +int scene_obj_set_width(struct scene *scn, uint id, int w) +{ + struct scene_obj *obj; + + obj = scene_obj_find(scn, id, SCENEOBJT_NONE); + if (!obj) + return log_msg_ret("find", -ENOENT); + obj->bbox.x1 = obj->bbox.x0 + w; + + return 0; +} + +int scene_obj_set_bbox(struct scene *scn, uint id, int x0, int y0, int x1, + int y1) +{ + struct scene_obj *obj; + + obj = scene_obj_find(scn, id, SCENEOBJT_NONE); + if (!obj) + return log_msg_ret("find", -ENOENT); + obj->bbox.x0 = x0; + obj->bbox.y0 = y0; + obj->bbox.x1 = x1; + obj->bbox.y1 = y1; + obj->flags |= SCENEOF_SIZE_VALID; + + return 0; +} + int scene_obj_set_hide(struct scene *scn, uint id, bool hide) { int ret; |
