9
0
Fork 0

gui: convert graphic utils to respect line_length

Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Andre Heider 2013-11-05 00:01:00 +01:00 committed by Sascha Hauer
parent 485544f0fb
commit 3ad1765467
1 changed files with 5 additions and 5 deletions

View File

@ -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 line_length;
int img_byte_per_pixel = 3;
void *image;
if (is_rgba)
img_byte_per_pixel++;
xres = info->xres;
line_length = info->line_length;
for (y = 0; y < height; y++) {
adr = buf + ((y + starty) * xres + startx) *
(info->bits_per_pixel >> 3);
adr = buf + (y + starty) * line_length +
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.line_length * sc->s.height;
if (offscreen) {
/* Don't fail if malloc fails, just continue rendering directly