All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Mandel <o.mandel@menlosystems.com>
To: openembedded-core@lists.openembedded.org
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Subject: [PATCH 2/2] Make appearance more configurable
Date: Tue, 07 Oct 2014 18:44:11 +0200	[thread overview]
Message-ID: <5434185B.7050906@menlosystems.com> (raw)
In-Reply-To: <5433FBD2.9070503@menlosystems.com>


[-- Attachment #1.1: Type: text/plain, Size: 2 bytes --]



[-- Attachment #1.2: 0002-Make-appearance-more-configurable.patch --]
[-- Type: text/plain, Size: 5843 bytes --]

From ca876147d839a33fb1a397cda682d307554cb1d7 Mon Sep 17 00:00:00 2001
From: Olaf Mandel <o.mandel@menlosystems.com>
Date: Tue, 7 Oct 2014 15:43:20 +0200
Subject: [PATCH 2/2] Make appearance more configurable

 * Allow not showing the startup message
 * Make the screen-split (between image and progress bar)
   configurable
 * Allow for fullscreen image (overlaid by progress bar)

Signed-off-by: Olaf Mandel <o.mandel@menlosystems.com>
---
 ChangeLog        |    9 +++++++++
 Makefile.am      |    2 +-
 psplash-config.h |   34 ++++++++++++++++++++++++++++++++++
 psplash.c        |   28 +++++++++++++++++++++-------
 psplash.h        |    1 -
 5 files changed, 65 insertions(+), 9 deletions(-)
 create mode 100644 psplash-config.h

diff --git a/ChangeLog b/ChangeLog
index f4fd0ec..42163db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,15 @@
 	* psplash.c:
 	Images: handle rowstride != width*bytes_per_pixel
 
+	* psplash-config.h:
+	* psplash.c:
+	* psplash.h:
+	Make appearance more configurable:
+	  - Allow not showing the startup message
+	  - Make the screen-split (between image and progress bar)
+	    configurable
+	  - Allow for fullscreen image (overlaid by progress bar)
+
 2009-05-28  Richard Purdie <rpurdie@linux.intel.com>
 
 	* psplash-fb.c:
diff --git a/Makefile.am b/Makefile.am
index c90ebfa..a14152a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ AM_CFLAGS = $(GCC_FLAGS) -D_GNU_SOURCE
 
 psplash_SOURCES = psplash.c psplash.h psplash-fb.c psplash-fb.h \
                   psplash-console.c psplash-console.h           \
-		  psplash-colors.h				\
+		  psplash-colors.h psplash-config.h		\
 		  psplash-poky-img.h psplash-bar-img.h radeon-font.h
 
 psplash_write_SOURCES = psplash-write.c psplash.h
diff --git a/psplash-config.h b/psplash-config.h
new file mode 100644
index 0000000..82bb76d
--- /dev/null
+++ b/psplash-config.h
@@ -0,0 +1,34 @@
+/*
+ *  pslash - a lightweight framebuffer splashscreen for embedded devices.
+ *
+ *  Copyright (c) 2014 MenloSystems GmbH
+ *  Author: Olaf Mandel <o.mandel@menlosystems.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ */
+
+#ifndef _HAVE_PSPLASH_CONFIG_H
+#define _HAVE_PSPLASH_CONFIG_H
+
+/* Text to output on program start; if undefined, output nothing */
+#define PSPLASH_STARTUP_MSG ""
+
+/* Bool indicating if the image is fullscreen, as opposed to split screen */
+#define PSPLASH_IMG_FULLSCREEN 0
+
+/* Position of the image split from top edge, numerator of fraction */
+#define PSPLASH_IMG_SPLIT_NUMERATOR 5
+
+/* Position of the image split from top edge, denominator of fraction */
+#define PSPLASH_IMG_SPLIT_DENOMINATOR 6
+
+#endif
diff --git a/psplash.c b/psplash.c
index 543f67e..22af68d 100644
--- a/psplash.c
+++ b/psplash.c
@@ -19,11 +19,18 @@
  */
 
 #include "psplash.h"
+#include "psplash-config.h"
+#include "psplash-colors.h"
 #include "psplash-poky-img.h"
 #include "psplash-bar-img.h"
 #include "radeon-font.h"
 
-#define MSG ""
+#define SPLIT_LINE_POS(fb)                                  \
+	(  (fb)->height                                     \
+	 - ((  PSPLASH_IMG_SPLIT_DENOMINATOR                \
+	     - PSPLASH_IMG_SPLIT_NUMERATOR)                 \
+	    * (fb)->height / PSPLASH_IMG_SPLIT_DENOMINATOR) \
+	)
 
 void
 psplash_exit (int signum)
@@ -46,14 +53,14 @@ psplash_draw_msg (PSplashFB *fb, const char *msg)
 
   psplash_fb_draw_rect (fb, 
 			0, 
-			fb->height - (fb->height/6) - h, 
+			SPLIT_LINE_POS(fb) - h, 
 			fb->width,
 			h,
 			PSPLASH_BACKGROUND_COLOR);
 
   psplash_fb_draw_text (fb,
 			(fb->width-w)/2, 
-			fb->height - (fb->height/6) - h,
+			SPLIT_LINE_POS(fb) - h,
 			PSPLASH_TEXT_COLOR,
 			&radeon_font,
 			msg);
@@ -66,7 +73,7 @@ psplash_draw_progress (PSplashFB *fb, int value)
 
   /* 4 pix border */
   x      = ((fb->width  - BAR_IMG_WIDTH)/2) + 4 ;
-  y      = fb->height - (fb->height/6) + 4;
+  y      = SPLIT_LINE_POS(fb) + 4;
   width  = BAR_IMG_WIDTH - 8; 
   height = BAR_IMG_HEIGHT - 8;
 
@@ -270,7 +277,12 @@ main (int argc, char** argv)
   /* Draw the Poky logo  */
   psplash_fb_draw_image (fb, 
 			 (fb->width  - POKY_IMG_WIDTH)/2, 
-			 ((fb->height * 5) / 6 - POKY_IMG_HEIGHT)/2,
+#if PSPLASH_IMG_FULLSCREEN
+			 (fb->height - POKY_IMG_HEIGHT)/2,
+#else
+			 (fb->height * PSPLASH_IMG_SPLIT_NUMERATOR
+			  / PSPLASH_IMG_SPLIT_DENOMINATOR - POKY_IMG_HEIGHT)/2,
+#endif
 			 POKY_IMG_WIDTH,
 			 POKY_IMG_HEIGHT,
 			 POKY_IMG_BYTES_PER_PIXEL,
@@ -280,7 +292,7 @@ main (int argc, char** argv)
   /* Draw progress bar border */
   psplash_fb_draw_image (fb, 
 			 (fb->width  - BAR_IMG_WIDTH)/2, 
-			 fb->height - (fb->height/6), 
+			 SPLIT_LINE_POS(fb),
 			 BAR_IMG_WIDTH,
 			 BAR_IMG_HEIGHT,
 			 BAR_IMG_BYTES_PER_PIXEL,
@@ -289,7 +301,9 @@ main (int argc, char** argv)
 
   psplash_draw_progress (fb, 0);
 
-  psplash_draw_msg (fb, MSG);
+#ifdef PSPLASH_STARTUP_MSG
+  psplash_draw_msg (fb, PSPLASH_STARTUP_MSG);
+#endif
 
   psplash_main (fb, pipe_fd, 0);
 
diff --git a/psplash.h b/psplash.h
index f78c117..22d73a3 100644
--- a/psplash.h
+++ b/psplash.h
@@ -83,6 +83,5 @@ PSplashFont;
 
 #include "psplash-fb.h"
 #include "psplash-console.h"
-#include "psplash-colors.h"
 
 #endif
-- 
1.7.10.4



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

       reply	other threads:[~2014-10-07 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5433FBD2.9070503@menlosystems.com>
2014-10-07 16:44 ` Olaf Mandel [this message]
2014-10-31 15:34 ` [PATCH 2/2] Make appearance more configurable Paul Eggleton

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=5434185B.7050906@menlosystems.com \
    --to=o.mandel@menlosystems.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.