aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Frydrych <tomas@sleepfive.com>2012-05-10 07:44:18 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-10 11:47:29 +0100
commit84764337a584002a92940323d374b0e417c573a6 (patch)
tree3ce3b2fe0981d56cf761ec03e4e2ea8f48642e6c
parente05374aae945bcfc6d962ed0d7b2774b77987e1d (diff)
downloadpsplash-84764337a584002a92940323d374b0e417c573a6.tar.gz
psplash-84764337a584002a92940323d374b0e417c573a6.tar.bz2
psplash-84764337a584002a92940323d374b0e417c573a6.zip
Make it easier to customise colours
This commit moves colour definitions to psplash-colors.h so that the colour scheme can be easily modified by replacing this file rather than having to maintain a patch. Signed-off-by: Tomas Frydrych <tomas@sleepfive.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--Makefile.am1
-rw-r--r--psplash-colors.h34
-rw-r--r--psplash.c15
-rw-r--r--psplash.h1
4 files changed, 44 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index 75d4af3..c90ebfa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,6 +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-poky-img.h psplash-bar-img.h radeon-font.h
psplash_write_SOURCES = psplash-write.c psplash.h
diff --git a/psplash-colors.h b/psplash-colors.h
new file mode 100644
index 0000000..d701089
--- /dev/null
+++ b/psplash-colors.h
@@ -0,0 +1,34 @@
+/*
+ * pslash - a lightweight framebuffer splashscreen for embedded devices.
+ *
+ * Copyright (c) 2012 sleep(5) ltd
+ * Author: Tomas Frydrych <tomas@sleepfive.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_COLORS_H
+#define _HAVE_PSPLASH_COLORS_H
+
+/* This is the overall background color */
+#define PSPLASH_BACKGROUND_COLOR 0xec,0xec,0xe1
+
+/* This is the color of any text output */
+#define PSPLASH_TEXT_COLOR 0x6d,0x6d,0x70
+
+/* This is the color of the progress bar indicator */
+#define PSPLASH_BAR_COLOR 0x6d,0x6d,0x70
+
+/* This is the color of the progress bar background */
+#define PSPLASH_BAR_BACKGROUND_COLOR 0xec,0xec,0xe1
+
+#endif
diff --git a/psplash.c b/psplash.c
index 2eaa11e..0158628 100644
--- a/psplash.c
+++ b/psplash.c
@@ -49,12 +49,12 @@ psplash_draw_msg (PSplashFB *fb, const char *msg)
fb->height - (fb->height/6) - h,
fb->width,
h,
- 0xec, 0xec, 0xe1);
+ PSPLASH_BACKGROUND_COLOR);
psplash_fb_draw_text (fb,
(fb->width-w)/2,
fb->height - (fb->height/6) - h,
- 0x6d, 0x6d, 0x70,
+ PSPLASH_TEXT_COLOR,
&radeon_font,
msg);
}
@@ -75,19 +75,19 @@ psplash_draw_progress (PSplashFB *fb, int value)
barwidth = (CLAMP(value,0,100) * width) / 100;
psplash_fb_draw_rect (fb, x + barwidth, y,
width - barwidth, height,
- 0xec, 0xec, 0xe1);
+ PSPLASH_BAR_BACKGROUND_COLOR);
psplash_fb_draw_rect (fb, x, y, barwidth,
- height, 0x6d, 0x6d, 0x70);
+ height, PSPLASH_BAR_COLOR);
}
else
{
barwidth = (CLAMP(-value,0,100) * width) / 100;
psplash_fb_draw_rect (fb, x, y,
width - barwidth, height,
- 0xec, 0xec, 0xe1);
+ PSPLASH_BAR_BACKGROUND_COLOR);
psplash_fb_draw_rect (fb, x + width - barwidth,
y, barwidth, height,
- 0x6d, 0x6d, 0x70);
+ PSPLASH_BAR_COLOR);
}
DBG("value: %i, width: %i, barwidth :%i\n", value,
@@ -264,7 +264,8 @@ main (int argc, char** argv)
}
/* Clear the background with #ecece1 */
- psplash_fb_draw_rect (fb, 0, 0, fb->width, fb->height, 0xec, 0xec, 0xe1);
+ psplash_fb_draw_rect (fb, 0, 0, fb->width, fb->height,
+ PSPLASH_BACKGROUND_COLOR);
/* Draw the Poky logo */
psplash_fb_draw_image (fb,
diff --git a/psplash.h b/psplash.h
index 22d73a3..f78c117 100644
--- a/psplash.h
+++ b/psplash.h
@@ -83,5 +83,6 @@ PSplashFont;
#include "psplash-fb.h"
#include "psplash-console.h"
+#include "psplash-colors.h"
#endif