diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-15 07:30:48 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-16 09:13:04 +0200 |
commit | 3ea4dee7fddd7a04f663da5884596501c434a771 (patch) | |
tree | 503046b9d571a8467d6f0d7df363d0ca18a605d3 /lib | |
parent | 976ad2aea264c0af632d1429e16ca9a03cc55bbe (diff) | |
download | barebox-3ea4dee7fddd7a04f663da5884596501c434a771.tar.gz barebox-3ea4dee7fddd7a04f663da5884596501c434a771.tar.xz |
graphics_utils: Export get_pixel
get_pixel converts a 32bit trgb color into framebuffer format. This
is useful for other code aswell, so export it.
Other functions in the graphics utils code use the name get/set_pixel
aswell, but instead of converting data they get a pixel from the framebuffer
or set a pixel on the framebuffer. To separate from these rename the
function to gu_hex_to_pixel.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gui/graphic_utils.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c index 6d2540fc96..516e90312b 100644 --- a/lib/gui/graphic_utils.c +++ b/lib/gui/graphic_utils.c @@ -7,7 +7,17 @@ #include <fs.h> #include <malloc.h> -static u32 get_pixel(struct fb_info *info, u32 color) +/** + * gu_hex_to_pixel - convert a 32bit color to fb format + * @info: The framebuffer info to convert the pixel for + * @color: The color in 0xttrrggbb format + * + * This converts a color in 0xttrrggbb format to the format + * suitable for writing directly into the framebuffer. + * + * Return: The pixel suitable for the framebuffer + */ +u32 gu_hex_to_pixel(struct fb_info *info, u32 color) { u32 px; u8 t = (color >> 24) & 0xff; @@ -51,7 +61,7 @@ void gu_memset_pixel(struct fb_info *info, void* buf, u32 color, size_t size) u32 px; u8 *screen = buf; - px = get_pixel(info, color); + px = gu_hex_to_pixel(info, color); switch (info->bits_per_pixel) { case 8: |