summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-02-21 01:23:30 +0000
committerDave Chapman <dave@dchapman.com>2006-02-21 01:23:30 +0000
commit95538f694901263d7a5282901acb73958082ea82 (patch)
tree78eeb5df5820216e2b61756b0e14cf92b1f94ae1
parentd04dbca00b2f288aa02978623cf9f412fb09c56b (diff)
downloadrockbox-95538f694901263d7a5282901acb73958082ea82.tar.gz
rockbox-95538f694901263d7a5282901acb73958082ea82.zip
First attempt at generating and using .h files from bitmaps using bmp2rb. The .h files are generated for both the core bitmaps and the plugins, but are only currently being used in the core.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8759 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/Makefile7
-rw-r--r--apps/bitmaps/mono/Makefile1
-rw-r--r--apps/bitmaps/native/Makefile1
-rw-r--r--apps/bitmaps/remote_mono/Makefile1
-rw-r--r--apps/bitmaps/remote_native/Makefile1
-rw-r--r--apps/misc.c6
-rw-r--r--apps/plugins/Makefile8
-rw-r--r--apps/plugins/bitmaps/mono/Makefile1
-rw-r--r--apps/plugins/bitmaps/native/Makefile1
-rw-r--r--apps/plugins/bitmaps/remote_mono/Makefile1
-rw-r--r--apps/plugins/bitmaps/remote_native/Makefile1
-rw-r--r--apps/recorder/icons.h49
-rw-r--r--tools/bmp2rb.c61
13 files changed, 85 insertions, 54 deletions
diff --git a/apps/Makefile b/apps/Makefile
index 26f96a5b79..55386c9e43 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -8,7 +8,7 @@
#
INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
+ -I$(BUILDDIR)/bitmaps -I$(OBJDIR)
DEPFILE = $(OBJDIR)/dep-apps
LDS := $(FIRMDIR)/app.lds
@@ -85,6 +85,8 @@ endif
all: $(REALBIN) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
endif
+$(DEPFILE): $(BITMAPLIBS)
+
dep: $(DEPFILE)
build-codecs:
@@ -95,7 +97,7 @@ build-bitmaps:
@$(MAKE) -C bitmaps OBJDIR=$(OBJDIR)/bitmaps
$(BITMAPLIBS): build-bitmaps
-
+
rocks: build-codecs
@$(MAKE) -C plugins/lib OBJDIR=$(OBJDIR)/plugins/lib
@$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
@@ -212,6 +214,7 @@ clean:
@$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins
@$(MAKE) -C codecs clean OBJDIR=$(OBJDIR)/codecs
@rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
+ @rm -rf $(BUILDDIR)/bitmaps
ifdef SIMVER
@$(MAKE) -C $(SIMDIR) clean
endif
diff --git a/apps/bitmaps/mono/Makefile b/apps/bitmaps/mono/Makefile
index ec75520735..a678b01ef4 100644
--- a/apps/bitmaps/mono/Makefile
+++ b/apps/bitmaps/mono/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-mono
BMP2RB = $(BMP2RB_MONO)
OUTPUT = $(BUILDDIR)/libbitmapsmono.a
+BMPINCDIR = $(BUILDDIR)/pluginbitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/bitmaps/native/Makefile b/apps/bitmaps/native/Makefile
index 17e9376dd9..49e941799e 100644
--- a/apps/bitmaps/native/Makefile
+++ b/apps/bitmaps/native/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-native
BMP2RB = $(BMP2RB_NATIVE)
OUTPUT = $(BUILDDIR)/libbitmapsnative.a
+BMPINCDIR = $(BUILDDIR)/bitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/bitmaps/remote_mono/Makefile b/apps/bitmaps/remote_mono/Makefile
index 9f6997c71a..4e119ba76d 100644
--- a/apps/bitmaps/remote_mono/Makefile
+++ b/apps/bitmaps/remote_mono/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-remotemono
BMP2RB = $(BMP2RB_REMOTEMONO)
OUTPUT = $(BUILDDIR)/libbitmapsremotemono.a
+BMPINCDIR = $(BUILDDIR)/pluginbitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/bitmaps/remote_native/Makefile b/apps/bitmaps/remote_native/Makefile
index 882505ded9..573ee554b2 100644
--- a/apps/bitmaps/remote_native/Makefile
+++ b/apps/bitmaps/remote_native/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-remotenative
BMP2RB = $(BMP2RB_REMOTENATIVE)
OUTPUT = $(BUILDDIR)/libbitmapsremotenative.a
+BMPINCDIR = $(BUILDDIR)/bitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/misc.c b/apps/misc.c
index c815589c06..6493e7b46f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -604,12 +604,12 @@ int show_logo( void )
int font_h, font_w;
lcd_clear_display();
- lcd_bitmap(rockboxlogo, 0, 10, ROCKBOXLOGO_WIDTH, ROCKBOXLOGO_HEIGHT);
+ lcd_bitmap(rockboxlogo, 0, 10, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo);
#ifdef HAVE_REMOTE_LCD
lcd_remote_clear_display();
- lcd_remote_bitmap(remote_rockboxlogo,10,14,REMOTE_ROCKBOXLOGO_WIDTH,
- REMOTE_ROCKBOXLOGO_HEIGHT);
+ lcd_remote_bitmap(remote_rockboxlogo,10,14,BMPWIDTH_remote_rockboxlogo,
+ BMPHEIGHT_remote_rockboxlogo);
#endif
snprintf(version, sizeof(version), "Ver. %s", appsversion);
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
index f7bd102a5b..404f1662e2 100644
--- a/apps/plugins/Makefile
+++ b/apps/plugins/Makefile
@@ -8,7 +8,8 @@
#
INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \
- -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR)
+ -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR) \
+ -I$(BUILDDIR)/pluginbitmaps
CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
@@ -72,6 +73,10 @@ endif
.PHONY: $(SUBDIRS)
all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE)
+$(DEPFILE): $(BITMAPLIBS)
+
+dep: $(DEPFILE)
+
$(BUILDDIR)/credits.raw: $(DOCSDIR)/CREDITS
@echo "create credits.raw"
$(SILENT)perl credits.pl < $< > $@
@@ -197,5 +202,6 @@ clean:
$(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
$(SILENT)$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy
$(SILENT)$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine
+ @rm -rf $(BUILDDIR)/pluginbitmaps
-include $(DEPFILE)
diff --git a/apps/plugins/bitmaps/mono/Makefile b/apps/plugins/bitmaps/mono/Makefile
index 54c06770b8..7b7e052117 100644
--- a/apps/plugins/bitmaps/mono/Makefile
+++ b/apps/plugins/bitmaps/mono/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-mono
BMP2RB = $(BMP2RB_MONO)
OUTPUT = $(BUILDDIR)/libpluginbitmapsmono.a
+BMPINCDIR = $(BUILDDIR)/pluginbitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/plugins/bitmaps/native/Makefile b/apps/plugins/bitmaps/native/Makefile
index fd77a6213c..d7745ee9e2 100644
--- a/apps/plugins/bitmaps/native/Makefile
+++ b/apps/plugins/bitmaps/native/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-native
BMP2RB = $(BMP2RB_NATIVE)
OUTPUT = $(BUILDDIR)/libpluginbitmapsnative.a
+BMPINCDIR = $(BUILDDIR)/pluginbitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/plugins/bitmaps/remote_mono/Makefile b/apps/plugins/bitmaps/remote_mono/Makefile
index 0875b4cbb5..db846e23a7 100644
--- a/apps/plugins/bitmaps/remote_mono/Makefile
+++ b/apps/plugins/bitmaps/remote_mono/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-remotemono
BMP2RB = $(BMP2RB_REMOTEMONO)
OUTPUT = $(BUILDDIR)/libpluginbitmapsremotemono.a
+BMPINCDIR = $(BUILDDIR)/pluginbitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/plugins/bitmaps/remote_native/Makefile b/apps/plugins/bitmaps/remote_native/Makefile
index 91a42908f5..405f3fd5af 100644
--- a/apps/plugins/bitmaps/remote_native/Makefile
+++ b/apps/plugins/bitmaps/remote_native/Makefile
@@ -21,6 +21,7 @@ DEPFILE = $(OBJDIR)/dep-bitmaps-remotenative
BMP2RB = $(BMP2RB_REMOTENATIVE)
OUTPUT = $(BUILDDIR)/libpluginbitmapsremotenative.a
+BMPINCDIR = $(BUILDDIR)/pluginbitmaps
include $(TOOLSDIR)/makebmp.inc
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 14e84cd64f..62ed73aeac 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -21,11 +21,19 @@
#include <lcd.h>
+#ifdef HAVE_LCD_BITMAP
+
+/* External bitmaps */
+
+#include <rockboxlogo.h>
+#ifdef HAVE_REMOTE_LCD
+#include <remote_rockboxlogo.h>
+#endif
+
/*
* Icons of size 6x8 pixels
*/
-#ifdef HAVE_LCD_BITMAP
/* Symbolic names for icons */
enum icons_5x8 {
@@ -78,45 +86,6 @@ extern const unsigned char bitmap_icons_6x8[Icon6x8Last][6];
extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7];
extern const unsigned char bitmap_icon_disk[];
-extern const fb_data rockboxlogo[];
-
-#if LCD_DEPTH == 1
-/* Archos targets */
-#define ROCKBOXLOGO_WIDTH 112
-#define ROCKBOXLOGO_HEIGHT 37
-
-#elif (LCD_WIDTH == 160) && (LCD_DEPTH == 2)
-/* iRiver H1x0 */
-#define ROCKBOXLOGO_WIDTH 160
-#define ROCKBOXLOGO_HEIGHT 53
-
-#elif (LCD_WIDTH == 160) && (LCD_DEPTH == 16)
-/* iAudio X5 */
-#define ROCKBOXLOGO_WIDTH 160
-#define ROCKBOXLOGO_HEIGHT 50
-
-#elif (LCD_WIDTH == 176) && (LCD_DEPTH == 16)
-/* iPod Nano */
-#define ROCKBOXLOGO_WIDTH 176
-#define ROCKBOXLOGO_HEIGHT 54
-
-#elif (LCD_WIDTH == 320) && (LCD_DEPTH == 16)
-/* iPod Video */
-#define ROCKBOXLOGO_WIDTH 320
-#define ROCKBOXLOGO_HEIGHT 98
-
-#elif (LCD_WIDTH >= 220) && (LCD_DEPTH == 16)
-/* iriver H3x0, iPod Color/Photo */
-#define ROCKBOXLOGO_WIDTH 220
-#define ROCKBOXLOGO_HEIGHT 68
-#endif
-
-#ifdef HAVE_REMOTE_LCD
-extern const unsigned char remote_rockboxlogo[];
-#define REMOTE_ROCKBOXLOGO_WIDTH 112
-#define REMOTE_ROCKBOXLOGO_HEIGHT 37
-#endif
-
#define STATUSBAR_X_POS 0
#define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */
#define STATUSBAR_HEIGHT 8
diff --git a/tools/bmp2rb.c b/tools/bmp2rb.c
index d50b8c6f33..16bf7d9633 100644
--- a/tools/bmp2rb.c
+++ b/tools/bmp2rb.c
@@ -412,22 +412,47 @@ int transform_bitmap(const struct RGBQUAD *src, int width, int height,
* some #define's
****************************************************************************/
-void generate_c_source(char *id, int width, int height,
+void generate_c_source(char *id, char* header_dir, int width, int height,
const unsigned short *t_bitmap, int t_width,
int t_height, int t_depth)
{
FILE *f;
+ FILE *fh;
int i, a;
-
- f = stdout;
+ char header_name[1024];
if (!id || !id[0])
id = "bitmap";
- fprintf(f,
- "#define BMPHEIGHT_%s %ld\n"
- "#define BMPWIDTH_%s %ld\n",
- id, height, id, width);
+ f = stdout;
+
+ if (header_dir && header_dir[0])
+ {
+ snprintf(header_name,sizeof(header_name),"%s/%s.h",header_dir,id);
+ fh = fopen(header_name,"w+");
+
+ if (fh == NULL)
+ {
+ debugf("error - can't open '%s'\n", header_name);
+ return;
+ }
+ fprintf(fh,
+ "#define BMPHEIGHT_%s %ld\n"
+ "#define BMPWIDTH_%s %ld\n",
+ id, height, id, width);
+ if (t_depth <= 8)
+ fprintf(fh, "extern const unsigned char %s[];\n", id);
+ else
+ fprintf(fh, "extern const unsigned short %s[];\n", id);
+
+ fclose(fh);
+ } else {
+ fprintf(f,
+ "#define BMPHEIGHT_%s %ld\n"
+ "#define BMPWIDTH_%s %ld\n",
+ id, height, id, width);
+ }
+
if (t_depth <= 8)
fprintf(f, "const unsigned char %s[] = {\n", id);
else
@@ -478,6 +503,7 @@ void print_usage(void)
{
printf("Usage: %s [-i <id>] [-a] <bitmap file>\n"
"\t-i <id> Bitmap name (default is filename without extension)\n"
+ "\t-h <dir> Create header file in <dir>/<id>.h\n"
"\t-a Show ascii picture of bitmap\n"
"\t-f <n> Generate destination format n, default = 0\n"
"\t 0 Archos recorder, Ondio, Gmini 120/SP, Iriver H1x0 mono\n"
@@ -495,6 +521,7 @@ int main(int argc, char **argv)
{
char *bmp_filename = NULL;
char *id = NULL;
+ char* header_dir = NULL;
int i;
int ascii = false;
int format = 0;
@@ -510,6 +537,23 @@ int main(int argc, char **argv)
{
switch (argv[i][1])
{
+ case 'h': /* .h filename */
+ if (argv[i][2])
+ {
+ header_dir = &argv[i][2];
+ }
+ else if (argc > i+1)
+ {
+ header_dir = argv[i+1];
+ i++;
+ }
+ else
+ {
+ print_usage();
+ exit(1);
+ }
+ break;
+
case 'i': /* ID */
if (argv[i][2])
{
@@ -600,7 +644,8 @@ int main(int argc, char **argv)
if (transform_bitmap(bitmap, width, height, format, &t_bitmap,
&t_width, &t_height, &t_depth))
exit(1);
- generate_c_source(id, width, height, t_bitmap, t_width, t_height, t_depth);
+ generate_c_source(id, header_dir, width, height, t_bitmap,
+ t_width, t_height, t_depth);
}
return 0;