From: Simon Glass <simon.glass@canonical.com>
Add a function to render a single object by its ID. This provides a
convenient way to render individual objects without needing to look up
the object pointer first.
Assume that text mode is not used.
Co-developed-by: Claude <claude@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
boot/scene.c | 18 ++++++++++++++++++
boot/scene_internal.h | 9 +++++++++
2 files changed, 27 insertions(+)
@@ -903,6 +903,24 @@ int scene_arrange(struct scene *scn)
return 0;
}
+int scene_render_obj(struct scene *scn, uint id)
+{
+ struct scene_obj *obj;
+ int ret;
+
+ obj = scene_obj_find(scn, id, SCENEOBJT_NONE);
+ if (!obj)
+ return log_msg_ret("obj", -ENOENT);
+
+ if (!(obj->flags & SCENEOF_HIDE)) {
+ ret = scene_obj_render(obj, false);
+ if (ret && ret != -ENOTSUPP)
+ return log_msg_ret("ren", ret);
+ }
+
+ return 0;
+}
+
int scene_render_deps(struct scene *scn, uint id)
{
struct scene_obj *obj;
@@ -314,6 +314,15 @@ bool scene_textline_within(const struct scene *scn,
*/
int scene_send_click(struct scene *scn, int x, int y, struct expo_action *event);
+/**
+ * scene_render_obj() - Render an object
+ *
+ * @scn: Scene containing the object
+ * @id: Object ID to render
+ * Returns: 0 if OK, -ENOENT if object not found, -ve on other error
+ */
+int scene_render_obj(struct scene *scn, uint id);
+
/**
* scene_render_deps() - Render an object and its dependencies
*