mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 6/6] gui: blit the surface on demand
Date: Wed, 26 Sep 2012 11:59:04 +0200	[thread overview]
Message-ID: <1348653544-27095-6-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1348653544-27095-1-git-send-email-plagnioj@jcrosoft.com>

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>
---
 commands/splash.c           |    2 ++
 include/gui/graphic_utils.h |    1 +
 lib/gui/bmp.c               |    3 ---
 lib/gui/graphic_utils.c     |    8 ++++++++
 lib/gui/png.c               |    3 ---
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/commands/splash.c b/commands/splash.c
index 0292809..65dd530 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -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;
diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h
index 1a17790..33e0cbf 100644
--- a/include/gui/graphic_utils.h
+++ b/include/gui/graphic_utils.h
@@ -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__ */
diff --git a/lib/gui/bmp.c b/lib/gui/bmp.c
index c880375..d576121 100644
--- a/lib/gui/bmp.c
+++ b/lib/gui/bmp.c
@@ -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;
 }
 
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index 15a4109..3800ee2 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -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);
+}
diff --git a/lib/gui/png.c b/lib/gui/png.c
index 36b95f6..2921ab3 100644
--- a/lib/gui/png.c
+++ b/lib/gui/png.c
@@ -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;
 }
 
-- 
1.7.10.4


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

  parent reply	other threads:[~2012-09-26 10:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26  9:56 [PATCH 0/6] gui: factorise code Jean-Christophe PLAGNIOL-VILLARD
2012-09-26  9:58 ` [PATCH 1/6] image_renderer: fix size type Jean-Christophe PLAGNIOL-VILLARD
2012-09-26  9:59   ` [PATCH 2/6] gui: move gui file to include/gui and lib/gui Jean-Christophe PLAGNIOL-VILLARD
2012-09-26  9:59   ` [PATCH 3/6] graphic_utils: pass image so we can draw only the visible part of the image Jean-Christophe PLAGNIOL-VILLARD
2012-09-26  9:59   ` [PATCH 4/6] gui: introduce screen and surface to factorize and simplify code Jean-Christophe PLAGNIOL-VILLARD
2012-09-26  9:59   ` [PATCH 5/6] graphic_utils: introduce common fb_open/close Jean-Christophe PLAGNIOL-VILLARD
2012-09-26  9:59   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-09-30 13:47 ` [PATCH 0/6] gui: factorise code Jean-Christophe PLAGNIOL-VILLARD
2012-10-01 18:12   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-02  8:54     ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-02  9:37       ` Eric Bénard
2012-10-02 13:38       ` Sascha Hauer
2012-10-04 17:26 ` 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=1348653544-27095-6-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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