expo: Avoid setting SCENEOF_SIZE_VALID with calculated size

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>
This commit is contained in:
Simon Glass
2025-10-13 08:06:33 +01:00
parent e46bbc445a
commit dd14a85c36

View File

@@ -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;
}