expo: Provide a way to position things relative to display

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>
This commit is contained in:
Simon Glass
2025-05-02 08:46:53 -06:00
parent 8d7ae52d77
commit ddd1c97653
2 changed files with 11 additions and 0 deletions

View 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;

View 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
*