diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-10 21:31:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-16 09:03:05 +0200 |
commit | 976ad2aea264c0af632d1429e16ca9a03cc55bbe (patch) | |
tree | 792e3b66b633961ea7dcb7dde3e6e16f1c4d6c17 /lib | |
parent | ea532ddb865852ded9b7547bc2c7e2b64ad2ff7e (diff) | |
download | barebox-976ad2aea264c0af632d1429e16ca9a03cc55bbe.tar.gz barebox-976ad2aea264c0af632d1429e16ca9a03cc55bbe.tar.xz |
graphics_utils: Add function to invert an area
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gui/graphic_utils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c index ae2e9ca79b..6d2540fc96 100644 --- a/lib/gui/graphic_utils.c +++ b/lib/gui/graphic_utils.c @@ -128,6 +128,25 @@ static u8 alpha_mux(int s, int d, int a) return (d * a + s * (255 - a)) >> 8; } +void gu_invert_area(struct fb_info *info, void *buf, int startx, int starty, int width, + int height) +{ + unsigned char *adr; + int x, y; + int line_length; + int bpp = info->bits_per_pixel >> 3; + + line_length = info->line_length; + + for (y = starty; y < starty + height; y++) { + adr = buf + line_length * y + startx * bpp; + + for (x = 0; x < width * bpp; x++) { + *adr++ ^= 0xff; + } + } +} + void gu_set_rgba_pixel(struct fb_info *info, void *adr, u8 r, u8 g, u8 b, u8 a) { u32 px = 0x0; |