[PATCH 06/13] fb: add fb_rect functions

Sascha Hauer s.hauer at pengutronix.de
Thu Sep 26 06:15:04 PDT 2024


Add convenience functions for calculating the width/height of a
rectangle.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/fb.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/fb.h b/include/fb.h
index 2dd55eb83d..574a66a396 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -99,6 +99,16 @@ struct fb_rect {
 	u32 y2;
 };
 
+static inline int fb_rect_width(const struct fb_rect *r)
+{
+	return r->x2 - r->x1;
+}
+
+static inline int fb_rect_height(const struct fb_rect *r)
+{
+	return r->y2 - r->y1;
+}
+
 struct fb_ops {
 	/* set color register */
 	int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,

-- 
2.39.5




More information about the barebox mailing list