mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 6/8] gui: implement blitting screen areas
Date: Fri,  7 Aug 2015 15:45:39 +0200	[thread overview]
Message-ID: <1438955141-8850-7-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1438955141-8850-1-git-send-email-s.hauer@pengutronix.de>

So far we only supported blitting the whole screen from the shadow
fb to the framebuffer. Add a function to blit areas.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/splash.c           |  2 +-
 include/gui/graphic_utils.h |  2 ++
 lib/gui/graphic_utils.c     | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/commands/splash.c b/commands/splash.c
index dd4cfbe..15b296b 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -50,7 +50,7 @@ static int do_splash(int argc, char *argv[])
 	}
 	image_file = argv[optind];
 
-	sc = fb_open(fbdev, offscreen);
+	sc = fb_open(fbdev);
 	if (IS_ERR(sc)) {
 		perror("fd_open");
 		return PTR_ERR(sc);
diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h
index ff4d9a0..231b3a9 100644
--- a/include/gui/graphic_utils.h
+++ b/include/gui/graphic_utils.h
@@ -25,5 +25,7 @@ void fb_close(struct screen *sc);
 void gu_screen_blit(struct screen *sc);
 void gu_invert_area(struct fb_info *info, void *buf, int startx, int starty, int width,
 		int height);
+void gu_screen_blit_area(struct screen *sc, int startx, int starty, int width,
+		int height);
 
 #endif /* __GRAPHIC_UTILS_H__ */
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index b57b4a1..4c1885d 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -306,6 +306,25 @@ void fb_close(struct screen *sc)
 	free(sc);
 }
 
+void gu_screen_blit_area(struct screen *sc, int startx, int starty, int width,
+		int height)
+{
+	struct fb_info *info = sc->info;
+	int bpp = info->bits_per_pixel >> 3;
+
+	if (info->screen_base_shadow) {
+		int y;
+		void *fb = info->screen_base + starty * sc->info->line_length + startx * bpp;
+		void *fboff = info->screen_base_shadow + starty * sc->info->line_length + startx * bpp;
+
+		for (y = starty; y < starty + height; y++) {
+			memcpy(fb, fboff, width * bpp);
+			fb += sc->info->line_length;
+			fboff += sc->info->line_length;
+		}
+	}
+}
+
 void gu_screen_blit(struct screen *sc)
 {
 	struct fb_info *info = sc->info;
-- 
2.4.6


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

  parent reply	other threads:[~2015-08-07 13:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 13:45 [PATCH] fbconsole updates Sascha Hauer
2015-08-07 13:45 ` [PATCH 1/8] video: fbconsole: do not enter when we are already in fbconsole Sascha Hauer
2015-08-07 13:45 ` [PATCH 2/8] fb: return original fb_info in FBIOGET_SCREENINFO Sascha Hauer
2015-08-07 13:45 ` [PATCH 3/8] fb: Add shadowfb support Sascha Hauer
2015-08-07 13:45 ` [PATCH 4/8] splash command: simplify offscreen rendering Sascha Hauer
2015-08-07 13:45 ` [PATCH 5/8] gui: Use fb provided shadowfb for " Sascha Hauer
2015-08-07 13:45 ` Sascha Hauer [this message]
2015-08-07 13:45 ` [PATCH 7/8] fb: fbconsole: print cursor after clearing the screen Sascha Hauer
2015-08-07 13:45 ` [PATCH 8/8] fb: fbconsole: Add missing blits 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=1438955141-8850-7-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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