[Concept,04/16] expo: Avoid setting SCENEOF_SIZE_VALID with calculated size

Message ID 20251014111301.1059317-5-sjg@chromium.org
State New
Headers
Series boot: Separate out the boot-menu style |

Commit Message

Simon Glass Oct. 14, 2025, 11:12 a.m. UTC
  When the size of an object is calculated from its contents, we should
not set the SCENEOF_SIZE_VALID flag. This flag prevents the object from
resizing if the font is changed, for example. The flag is intended to
mean that the size was explicitly set by the controller, so we should
generally not set it in the expo implementation.

It is also inefficient to search for the object ID when we already
have the object.

Update scene_set_default_bbox() to just set the size and request that
it be synced.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/scene.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Patch

diff --git a/boot/scene.c b/boot/scene.c
index dd13b74b4d7..04a5e8a03e2 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -803,10 +803,12 @@  static int scene_set_default_bbox(struct scene *scn)
 		switch (obj->type) {
 		case SCENEOBJT_IMAGE:
 		case SCENEOBJT_TEXT:
-			if (!(obj->flags & SCENEOF_SIZE_VALID)) {
-				scene_obj_set_size(scn, obj->id, obj->dims.x,
-						   obj->dims.y);
-			}
+			if (obj->flags & SCENEOF_SIZE_VALID)
+				break;
+			obj->req_bbox.x1 = obj->req_bbox.x0 + obj->dims.x;
+			obj->req_bbox.y1 = obj->req_bbox.y0 + obj->dims.y;
+			obj->flags |= SCENEOF_SYNC_SIZE;
+			break;
 		default:
 			break;
 		}