diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | psplash-config.h | 34 | ||||
-rw-r--r-- | psplash.c | 28 | ||||
-rw-r--r-- | psplash.h | 1 |
5 files changed, 65 insertions, 9 deletions
@@ -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 @@ -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); @@ -83,6 +83,5 @@ PSplashFont; #include "psplash-fb.h" #include "psplash-console.h" -#include "psplash-colors.h" #endif |