expo: Separate dimensions from the bounding box
At present each object has a width and height and the bounding box is
implicit in that.
This is not flexible enough to handle objects which are larger than
their contents might need. For example, when centring a text object we
might want to have it stretch across the whole width of the display even
if the text itself does not need that much space.
Create a new 'dimensions' field and convert the existing width/height
into x1/y1 coordinates.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/test/boot/expo.c b/test/boot/expo.c
index 9c94082..94c13e9 100644
--- a/test/boot/expo.c
+++ b/test/boot/expo.c
@@ -550,39 +550,39 @@
ut_assertnonnull(obj);
ut_asserteq(400, obj->bbox.x0);
ut_asserteq(100, obj->bbox.y0);
- ut_asserteq(126, obj->bbox.w);
- ut_asserteq(40, obj->bbox.h);
+ ut_asserteq(400 + 126, obj->bbox.x1);
+ ut_asserteq(100 + 40, obj->bbox.y1);
/* check dimensions of image */
obj = scene_obj_find(scn, OBJ_LOGO, SCENEOBJT_NONE);
ut_assertnonnull(obj);
ut_asserteq(50, obj->bbox.x0);
ut_asserteq(20, obj->bbox.y0);
- ut_asserteq(160, obj->bbox.w);
- ut_asserteq(160, obj->bbox.h);
+ ut_asserteq(50 + 160, obj->bbox.x1);
+ ut_asserteq(20 + 160, obj->bbox.y1);
/* check dimensions of menu labels - both should be the same width */
obj = scene_obj_find(scn, ITEM1_LABEL, SCENEOBJT_NONE);
ut_assertnonnull(obj);
ut_asserteq(50, obj->bbox.x0);
ut_asserteq(436, obj->bbox.y0);
- ut_asserteq(29, obj->bbox.w);
- ut_asserteq(18, obj->bbox.h);
+ ut_asserteq(50 + 29, obj->bbox.x1);
+ ut_asserteq(436 + 18, obj->bbox.y1);
obj = scene_obj_find(scn, ITEM2_LABEL, SCENEOBJT_NONE);
ut_assertnonnull(obj);
ut_asserteq(50, obj->bbox.x0);
ut_asserteq(454, obj->bbox.y0);
- ut_asserteq(29, obj->bbox.w);
- ut_asserteq(18, obj->bbox.h);
+ ut_asserteq(50 + 29, obj->bbox.x1);
+ ut_asserteq(454 + 18, obj->bbox.y1);
/* check dimensions of menu */
obj = scene_obj_find(scn, OBJ_MENU, SCENEOBJT_NONE);
ut_assertnonnull(obj);
ut_asserteq(50, obj->bbox.x0);
ut_asserteq(400, obj->bbox.y0);
- ut_asserteq(160, obj->bbox.w);
- ut_asserteq(160, obj->bbox.h);
+ ut_asserteq(50 + 160, obj->bbox.x1);
+ ut_asserteq(400 + 160, obj->bbox.y1);
/* render it */
expo_set_scene_id(exp, SCENE1);