[PATCH 2/6] gui: convert graphic utils to respect the stride value
Andre Heider
a.heider at gmail.com
Thu Oct 24 16:23:42 EDT 2013
Signed-off-by: Andre Heider <a.heider at gmail.com>
---
lib/gui/graphic_utils.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index 95687df..9d80fe4 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -167,18 +167,18 @@ void rgba_blend(struct fb_info *info, struct image *img, void* buf, int height,
{
unsigned char *adr;
int x, y;
- int xres;
+ int stride;
int img_byte_per_pixel = 3;
void *image;
if (is_rgba)
img_byte_per_pixel++;
- xres = info->xres;
+ stride = info->stride;
for (y = 0; y < height; y++) {
- adr = buf + ((y + starty) * xres + startx) *
- (info->bits_per_pixel >> 3);
+ adr = buf + (y + starty) * stride +
+ startx * (info->bits_per_pixel >> 3);
image = img->data + (y * img->width *img_byte_per_pixel);
for (x = 0; x < width; x++) {
@@ -219,7 +219,7 @@ int fb_open(const char * fbdev, struct screen *sc, bool offscreen)
sc->s.y = 0;
sc->s.width = sc->info.xres;
sc->s.height = sc->info.yres;
- sc->fbsize = sc->s.width * sc->s.height * (sc->info.bits_per_pixel >> 3);
+ sc->fbsize = sc->info.stride * sc->s.height;
if (offscreen) {
/* Don't fail if malloc fails, just continue rendering directly
--
1.8.3.2
More information about the barebox
mailing list