9
0
Fork 0

gui: blit the surface on demand

Do not blit the surface everytime we write an image
As we want to able to render multiple image this will cause 1 blit per image;

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-09-26 11:59:04 +02:00 committed by Sascha Hauer
parent 9a048064e4
commit 5eb89cea2a
5 changed files with 11 additions and 6 deletions

View File

@ -68,6 +68,8 @@ static int do_splash(int argc, char *argv[])
if (image_renderer_file(&sc, &s, image_file) < 0)
ret = 1;
screen_blit(&sc);
fb_close(&sc);
return ret;

View File

@ -19,5 +19,6 @@ void set_rgba_pixel(struct fb_info *info, void *adr, u8 r, u8 g, u8 b, u8 a);
void memset_pixel(struct fb_info *info, void* buf, u32 color, size_t size);
int fb_open(const char * fbdev, struct screen *sc, bool offscreen);
void fb_close(struct screen *sc);
void screen_blit(struct screen *sc);
#endif /* __GRAPHIC_UTILS_H__ */

View File

@ -117,9 +117,6 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img)
} else
printf("bmp: illegal bits per pixel value: %d\n", bits_per_pixel);
if (sc->offscreenbuf)
memcpy(sc->fb, sc->offscreenbuf, sc->fbsize);
return img->height;
}

View File

@ -242,3 +242,11 @@ void fb_close(struct screen *sc)
free(sc->offscreenbuf);
close(sc->fd);
}
void screen_blit(struct screen *sc)
{
if (!sc->offscreenbuf)
return;
memcpy(sc->fb, sc->offscreenbuf, sc->fbsize);
}

View File

@ -69,9 +69,6 @@ static int png_renderer(struct screen *sc, struct surface *s, struct image *img)
rgba_blend(&sc->info, img, buf, height, width, startx, starty, true);
if (sc->offscreenbuf)
memcpy(sc->fb, sc->offscreenbuf, sc->fbsize);
return img->height;
}