It is often necessary to centre objects within the display area. Add a
special position value to indicate this.

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

 boot/scene.c   | 5 +++++
 include/expo.h | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/boot/scene.c b/boot/scene.c
index 02494fff603..7acd14b9eec 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -363,6 +363,11 @@ static void handle_alignment(enum scene_obj_align horiz,
 {
        int width, height;
 
+       if (bbox->x1 == SCENEOB_DISPLAY_MAX)
+               bbox->x1 = xsize ?: 1280;
+       if (bbox->y1 == SCENEOB_DISPLAY_MAX)
+               bbox->y1 = ysize ?: 1024;
+
        width = bbox->x1 - bbox->x0;
        height = bbox->y1 - bbox->y0;
 
diff --git a/include/expo.h b/include/expo.h
index 2addddd5012..4dee479e9a0 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -242,6 +242,12 @@ struct scene_obj_dims {
        int y;
 };
 
+/* special values for dimensions */
+enum {
+       /* width/height of the display */
+       SCENEOB_DISPLAY_MAX     = 0x7f000000,
+};
+
 /**
  * enum scene_obj_halign - Horizontal alignment of objects
  *
-- 
2.43.0

Reply via email to