diff options
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/graphic_utils.h | 2 | ||||
-rw-r--r-- | include/gui/gui.h | 36 | ||||
-rw-r--r-- | include/gui/image_renderer.h | 16 |
3 files changed, 44 insertions, 10 deletions
diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h index 4690e51e62..4cfb8e8d4d 100644 --- a/include/gui/graphic_utils.h +++ b/include/gui/graphic_utils.h @@ -9,6 +9,7 @@ #include <fb.h> #include <gui/image.h> +#include <gui/gui.h> void rgba_blend(struct fb_info *info, struct image *img, void* dest, int height, int width, int startx, int starty, bool is_rgba); @@ -16,5 +17,6 @@ void set_pixel(struct fb_info *info, void *adr, u32 px); void set_rgb_pixel(struct fb_info *info, void *adr, u8 r, u8 g, u8 b); void set_rgba_pixel(struct fb_info *info, void *adr, u8 r, u8 g, u8 b, u8 a); void memset_pixel(struct fb_info *info, void* buf, u32 color, size_t size); +int fb_open(const char * fbdev, struct screen *sc); #endif /* __GRAPHIC_UTILS_H__ */ diff --git a/include/gui/gui.h b/include/gui/gui.h new file mode 100644 index 0000000000..2f792f1017 --- /dev/null +++ b/include/gui/gui.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * GPL v2 + */ + +#ifndef __GUI_H__ +#define __GUI_H__ + +#include <fb.h> + +struct surface { + int x; + int y; + int width; + int height; +}; + +struct screen { + struct fb_info info; + + struct surface s; + + void *fb; + void *offscreenbuf; +}; + +static inline void* gui_screen_redering_buffer(struct screen *sc) +{ + if (sc->offscreenbuf) + return sc->offscreenbuf; + return sc->fb; +} + + +#endif /* __GUI_H__ */ diff --git a/include/gui/image_renderer.h b/include/gui/image_renderer.h index 5ee9969442..e0b1eae258 100644 --- a/include/gui/image_renderer.h +++ b/include/gui/image_renderer.h @@ -13,13 +13,13 @@ #include <linux/err.h> #include <fb.h> #include <gui/image.h> +#include <gui/gui.h> struct image_renderer { enum filetype type; struct image *(*open)(char *data, int size); void (*close)(struct image *img); - int (*renderer)(struct fb_info *info, struct image *img, void* fb, - int startx, int starty, void* offscreenbuf); + int (*renderer)(struct screen *sc, struct surface *s, struct image *img); /* * do not free the data read from the file @@ -34,8 +34,7 @@ struct image_renderer { int image_renderer_register(struct image_renderer *ir); void image_render_unregister(struct image_renderer *ir); -int image_renderer_image(struct fb_info *info, struct image *img, void* fb, - int startx, int starty, void* offscreenbuf); +int image_renderer_image(struct screen *sc, struct surface *s, struct image *img); struct image *image_renderer_open(const char* file); void image_renderer_close(struct image *img); @@ -54,12 +53,10 @@ static inline struct image *image_renderer_open(const char* file) static inline void image_renderer_close(struct image *img) {} -int image_renderer_image(struct fb_info *info, struct image *img, void* fb, - int startx, int starty, void* offscreenbuf); +int image_renderer_image(struct surface *s, struct image *img); #endif -static inline int image_renderer_file(struct fb_info *info, const char* file, void* fb, - int startx, int starty, void* offscreenbuf) +static inline int image_renderer_file(struct screen *sc, struct surface *s, const char* file) { struct image* img = image_renderer_open(file); int ret; @@ -67,8 +64,7 @@ static inline int image_renderer_file(struct fb_info *info, const char* file, vo if (IS_ERR(img)) return PTR_ERR(img); - ret = image_renderer_image(info, img, fb, startx, starty, - offscreenbuf); + ret = image_renderer_image(sc, s, img); image_renderer_close(img); |