]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
expo: Provide a way to position things relative to display
authorSimon Glass <sjg@chromium.org>
Fri, 2 May 2025 14:46:53 +0000 (08:46 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 30 May 2025 08:49:32 +0000 (09:49 +0100)
It is often necessary to centre objects within the display area. Add a
special position value to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/scene.c
include/expo.h

index 237f2bccc0010784e711422af6b037681c14d043..fa8f540bfb05c8953fb58f12b723d65402f7fbe3 100644 (file)
@@ -364,6 +364,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;
 
index 2addddd5012cd08dbb9cb165764207215bddce7b..4dee479e9a0307d3d6e15b0a2a94ce5fe3513b44 100644 (file)
@@ -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
  *