summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/gui/graphic_utils.h1
-rw-r--r--lib/gui/graphic_utils.c14
2 files changed, 13 insertions, 2 deletions
diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h
index 5c5c40a67d..136cac1f3e 100644
--- a/include/gui/graphic_utils.h
+++ b/include/gui/graphic_utils.h
@@ -11,6 +11,7 @@
#include <gui/image.h>
#include <gui/gui.h>
+u32 gu_hex_to_pixel(struct fb_info *info, u32 color);
void gu_rgba_blend(struct fb_info *info, struct image *img, void* dest, int height,
int width, int startx, int starty, bool is_rgba);
void gu_set_pixel(struct fb_info *info, void *adr, u32 px);
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: