mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 04/12] graphics_utils: Export get_pixel
Date: Thu, 16 Jul 2015 09:31:44 +0200	[thread overview]
Message-ID: <1437031912-24754-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1437031912-24754-1-git-send-email-s.hauer@pengutronix.de>

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>
---
 include/gui/graphic_utils.h |  1 +
 lib/gui/graphic_utils.c     | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h
index 5c5c40a..136cac1 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 6d2540f..516e903 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:
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-07-16  7:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16  7:31 Framebuffer console patches Sascha Hauer
2015-07-16  7:31 ` [PATCH 01/12] graphic_utils: Add a common namespace to functions Sascha Hauer
2015-07-16  7:31 ` [PATCH 02/12] gui: Fix typo in function name Sascha Hauer
2015-07-16  7:31 ` [PATCH 03/12] graphics_utils: Add function to invert an area Sascha Hauer
2015-07-16  7:31 ` Sascha Hauer [this message]
2015-07-16  7:31 ` [PATCH 05/12] graphics_utils: add function to create pixel from rgb triplet Sascha Hauer
2015-07-16  7:31 ` [PATCH 06/12] import lib/fonts framework from linux kernel Sascha Hauer
2015-07-16  7:31 ` [PATCH 07/12] lib/fonts: add "MINI4x6" font Sascha Hauer
2015-07-16  7:31 ` [PATCH 08/12] fonts: Add 7x14 font Sascha Hauer
2015-07-16  7:31 ` [PATCH 09/12] fb: Add fb_enable/disable functions Sascha Hauer
2015-07-16  7:31 ` [PATCH 10/12] fb: sdl: create graphics window on enabling Sascha Hauer
2015-07-16  7:31 ` [PATCH 11/12] graphics_utils: Let fb_open allocate the screen Sascha Hauer
2015-07-16  7:31 ` [PATCH 12/12] video: implement framebuffer console Sascha Hauer
2015-07-16  8:36   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437031912-24754-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox