summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-05-02 08:46:33 -0600
committerSimon Glass <[email protected]>2025-05-30 09:49:32 +0100
commitf04026a59f5384f32a452889fc199c06eaf1553e (patch)
treece4d093442b70f9ad64827d1c4880c5a5af4c714 /include
parent8636da86a2fb5f5f1a571f6cb3f12c0e8c207698 (diff)
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 <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/expo.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/include/expo.h b/include/expo.h
index b6de0310071..6f0547a4b38 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -9,6 +9,7 @@
#include <abuf.h>
#include <dm/ofnode_decl.h>
+#include <linux/bitops.h>
#include <linux/list.h>
struct udevice;
@@ -196,14 +197,29 @@ enum scene_obj_t {
*
* @x0: x position, in pixels from left side
* @y0: y position, in pixels from top
- * @w: width, in pixels
- * @h: height, in pixels
+ * @x1: x position of right size
+ * @y1: y position of bottom
*/
struct scene_obj_bbox {
int x0;
int y0;
- int w;
- int h;
+ int x1;
+ int y1;
+};
+
+/**
+ * struct scene_obj_dims - Dimensions of the object being drawn
+ *
+ * Image and text objects have a dimension which can change depending on what
+ * they contain. For images this stores the size. For text it stores the size as
+ * rendered on the display
+ *
+ * @x: x dimension
+ * @y: y dimension
+ */
+struct scene_obj_dims {
+ int x;
+ int y;
};
/**
@@ -213,11 +229,14 @@ struct scene_obj_bbox {
* @SCENEOF_POINT: object should be highlighted
* @SCENEOF_OPEN: object should be opened (e.g. menu is opened so that an option
* can be selected)
+ * @SCENEOF_SIZE_VALID: object's size (width/height) is valid, so any adjustment
+ * to x0/y0 should maintain the width/height of the object
*/
enum scene_obj_flags_t {
SCENEOF_HIDE = 1 << 0,
SCENEOF_POINT = 1 << 1,
SCENEOF_OPEN = 1 << 2,
+ SCENEOF_SIZE_VALID = BIT(3),
};
enum {
@@ -232,7 +251,8 @@ enum {
* @name: Name of the object (allocated)
* @id: ID number of the object
* @type: Type of this object
- * @bbox: Dimensions for this object
+ * @bbox: Bounding box for this object
+ * @dims: Dimensions of the text/image (may be smaller than bbox)
* @flags: Flags for this object
* @bit_length: Number of bits used for this object in CMOS RAM
* @start_bit: Start bit to use for this object in CMOS RAM
@@ -244,6 +264,7 @@ struct scene_obj {
uint id;
enum scene_obj_t type;
struct scene_obj_bbox bbox;
+ struct scene_obj_dims dims;
u8 flags;
u8 bit_length;
u16 start_bit;