summaryrefslogtreecommitdiff
path: root/boot/scene.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-06-01 19:22:53 +0300
committerTom Rini <trini@konsulko.com>2023-07-14 19:54:51 +0300
commit2e59389704cd1e46101f7ffda2dac3f44f2fa332 (patch)
tree2ec4afe667eb58b3eca7be70ec4522af44ca068c /boot/scene.c
parent699b0acb522fd808b67b745b541bacf18c275d15 (diff)
downloadu-boot-2e59389704cd1e46101f7ffda2dac3f44f2fa332.tar.xz
expo: Support simple themes
It is a pain to manually set the fonts of all objects to be consistent. Some spacing settings are also better set globally than by manually positioning each object. Add a 'theme' to the expo, to hold this information. For now it includes only the font size. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/scene.c')
-rw-r--r--boot/scene.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/boot/scene.c b/boot/scene.c
index 6d5e3c1f03..4dbe12a2b7 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -466,3 +466,31 @@ int scene_calc_dims(struct scene *scn, bool do_menus)
return 0;
}
+
+int scene_apply_theme(struct scene *scn, struct expo_theme *theme)
+{
+ struct scene_obj *obj;
+ int ret;
+
+ /* Avoid error-checking optional items */
+ scene_txt_set_font(scn, scn->title_id, NULL, theme->font_size);
+
+ list_for_each_entry(obj, &scn->obj_head, sibling) {
+ switch (obj->type) {
+ case SCENEOBJT_NONE:
+ case SCENEOBJT_IMAGE:
+ case SCENEOBJT_MENU:
+ break;
+ case SCENEOBJT_TEXT:
+ scene_txt_set_font(scn, obj->id, NULL,
+ theme->font_size);
+ break;
+ }
+ }
+
+ ret = scene_arrange(scn);
+ if (ret)
+ return log_msg_ret("arr", ret);
+
+ return 0;
+}