[PATCH 2/4] gui: graphic_utils: Stub out fb_* functions

Andrey Smirnov andrew.smirnov at gmail.com
Mon Feb 5 09:29:33 PST 2018


Stub out fb_* functions so as to avoid having to #ifdef the code using
them.

Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 include/gui/graphic_utils.h | 47 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h
index 279fdf91d..d4bac6394 100644
--- a/include/gui/graphic_utils.h
+++ b/include/gui/graphic_utils.h
@@ -11,6 +11,8 @@
 #include <gui/image.h>
 #include <gui/gui.h>
 
+#ifdef CONFIG_IMAGE_RENDERER
+
 u32 gu_hex_to_pixel(struct fb_info *info, u32 color);
 u32 gu_rgb_to_pixel(struct fb_info *info, u8 r, u8 g, u8 b, u8 t);
 void gu_rgba_blend(struct fb_info *info, struct image *img, void* dest, int height,
@@ -31,4 +33,49 @@ void gu_screen_blit_area(struct screen *sc, int startx, int starty, int width,
 void gu_fill_rectangle(struct screen *sc,
 		       int x1, int y1, int x2, int y2,
 		       u8 r, u8 g, u8 b, u8 a);
+#else
+
+static inline u32 gu_hex_to_pixel(struct fb_info *info, u32 color)
+{
+	return 0;
+}
+static inline u32 gu_rgb_to_pixel(struct fb_info *info, u8 r,
+				  u8 g, u8 b, u8 t)
+{
+	return 0;
+}
+static inline void gu_rgba_blend(struct fb_info *info, struct image *img,
+				 void* dest,int height,
+				 int width, int startx,
+				 int starty, bool is_rgba) {}
+static inline void gu_set_pixel(struct fb_info *info, void *adr, u32 px) {}
+static inline void gu_set_rgb_pixel(struct fb_info *info, void *adr,
+				    u8 r, u8 g, u8 b) {}
+static inline void gu_set_rgba_pixel(struct fb_info *info, void *adr,
+				     u8 r, u8 g, u8 b, u8 a) {}
+static inline void gu_memset_pixel(struct fb_info *info, void* buf,
+				   u32 color, size_t size) {}
+static inline struct screen *fb_create_screen(struct fb_info *info)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
+static inline struct screen *fb_open(const char *fbdev)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
+static inline void fb_close(struct screen *sc) {}
+static inline void gu_screen_blit(struct screen *sc) {}
+static inline void gu_invert_area(struct fb_info *info, void *buf, int startx,
+				  int starty, int width, int height) {}
+static inline void gu_screen_blit_area(struct screen *sc, int startx,
+				       int starty, int width,
+				       int height) {}
+static inline void gu_fill_rectangle(struct screen *sc, int x1, int y1,
+				     int x2, int y2, u8 r, u8 g, u8 b, u8 a) {}
+
+#endif
+
+
 #endif /* __GRAPHIC_UTILS_H__ */
-- 
2.14.3




More information about the barebox mailing list