summaryrefslogtreecommitdiff
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 @@
8# 8#
9 9
10INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \ 10INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
11 -I$(OBJDIR) 11 -I$(BUILDDIR)/bitmaps -I$(OBJDIR)
12 12
13DEPFILE = $(OBJDIR)/dep-apps 13DEPFILE = $(OBJDIR)/dep-apps
14LDS := $(FIRMDIR)/app.lds 14LDS := $(FIRMDIR)/app.lds
@@ -85,6 +85,8 @@ endif
85all: $(REALBIN) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM) 85all: $(REALBIN) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
86endif 86endif
87 87
88$(DEPFILE): $(BITMAPLIBS)
89
88dep: $(DEPFILE) 90dep: $(DEPFILE)
89 91
90build-codecs: 92build-codecs:
@@ -95,7 +97,7 @@ build-bitmaps:
95 @$(MAKE) -C bitmaps OBJDIR=$(OBJDIR)/bitmaps 97 @$(MAKE) -C bitmaps OBJDIR=$(OBJDIR)/bitmaps
96 98
97$(BITMAPLIBS): build-bitmaps 99$(BITMAPLIBS): build-bitmaps
98 100
99rocks: build-codecs 101rocks: build-codecs
100 @$(MAKE) -C plugins/lib OBJDIR=$(OBJDIR)/plugins/lib 102 @$(MAKE) -C plugins/lib OBJDIR=$(OBJDIR)/plugins/lib
101 @$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins 103 @$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
@@ -212,6 +214,7 @@ clean:
212 @$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins 214 @$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins
213 @$(MAKE) -C codecs clean OBJDIR=$(OBJDIR)/codecs 215 @$(MAKE) -C codecs clean OBJDIR=$(OBJDIR)/codecs
214 @rm -rf $(OBJDIR)/recorder $(OBJDIR)/player 216 @rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
217 @rm -rf $(BUILDDIR)/bitmaps
215ifdef SIMVER 218ifdef SIMVER
216 @$(MAKE) -C $(SIMDIR) clean 219 @$(MAKE) -C $(SIMDIR) clean
217endif 220endif
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
21 21
22BMP2RB = $(BMP2RB_MONO) 22BMP2RB = $(BMP2RB_MONO)
23OUTPUT = $(BUILDDIR)/libbitmapsmono.a 23OUTPUT = $(BUILDDIR)/libbitmapsmono.a
24BMPINCDIR = $(BUILDDIR)/pluginbitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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
21 21
22BMP2RB = $(BMP2RB_NATIVE) 22BMP2RB = $(BMP2RB_NATIVE)
23OUTPUT = $(BUILDDIR)/libbitmapsnative.a 23OUTPUT = $(BUILDDIR)/libbitmapsnative.a
24BMPINCDIR = $(BUILDDIR)/bitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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
21 21
22BMP2RB = $(BMP2RB_REMOTEMONO) 22BMP2RB = $(BMP2RB_REMOTEMONO)
23OUTPUT = $(BUILDDIR)/libbitmapsremotemono.a 23OUTPUT = $(BUILDDIR)/libbitmapsremotemono.a
24BMPINCDIR = $(BUILDDIR)/pluginbitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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
21 21
22BMP2RB = $(BMP2RB_REMOTENATIVE) 22BMP2RB = $(BMP2RB_REMOTENATIVE)
23OUTPUT = $(BUILDDIR)/libbitmapsremotenative.a 23OUTPUT = $(BUILDDIR)/libbitmapsremotenative.a
24BMPINCDIR = $(BUILDDIR)/bitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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 )
604 int font_h, font_w; 604 int font_h, font_w;
605 605
606 lcd_clear_display(); 606 lcd_clear_display();
607 lcd_bitmap(rockboxlogo, 0, 10, ROCKBOXLOGO_WIDTH, ROCKBOXLOGO_HEIGHT); 607 lcd_bitmap(rockboxlogo, 0, 10, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo);
608 608
609#ifdef HAVE_REMOTE_LCD 609#ifdef HAVE_REMOTE_LCD
610 lcd_remote_clear_display(); 610 lcd_remote_clear_display();
611 lcd_remote_bitmap(remote_rockboxlogo,10,14,REMOTE_ROCKBOXLOGO_WIDTH, 611 lcd_remote_bitmap(remote_rockboxlogo,10,14,BMPWIDTH_remote_rockboxlogo,
612 REMOTE_ROCKBOXLOGO_HEIGHT); 612 BMPHEIGHT_remote_rockboxlogo);
613#endif 613#endif
614 614
615 snprintf(version, sizeof(version), "Ver. %s", appsversion); 615 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 @@
8# 8#
9 9
10INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \ 10INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \
11 -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR) 11 -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR) \
12 -I$(BUILDDIR)/pluginbitmaps
12CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 13CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
13 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN 14 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
14 15
@@ -72,6 +73,10 @@ endif
72.PHONY: $(SUBDIRS) 73.PHONY: $(SUBDIRS)
73all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE) 74all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE)
74 75
76$(DEPFILE): $(BITMAPLIBS)
77
78dep: $(DEPFILE)
79
75$(BUILDDIR)/credits.raw: $(DOCSDIR)/CREDITS 80$(BUILDDIR)/credits.raw: $(DOCSDIR)/CREDITS
76 @echo "create credits.raw" 81 @echo "create credits.raw"
77 $(SILENT)perl credits.pl < $< > $@ 82 $(SILENT)perl credits.pl < $< > $@
@@ -197,5 +202,6 @@ clean:
197 $(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native 202 $(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
198 $(SILENT)$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy 203 $(SILENT)$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy
199 $(SILENT)$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine 204 $(SILENT)$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine
205 @rm -rf $(BUILDDIR)/pluginbitmaps
200 206
201-include $(DEPFILE) 207-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
21 21
22BMP2RB = $(BMP2RB_MONO) 22BMP2RB = $(BMP2RB_MONO)
23OUTPUT = $(BUILDDIR)/libpluginbitmapsmono.a 23OUTPUT = $(BUILDDIR)/libpluginbitmapsmono.a
24BMPINCDIR = $(BUILDDIR)/pluginbitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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
21 21
22BMP2RB = $(BMP2RB_NATIVE) 22BMP2RB = $(BMP2RB_NATIVE)
23OUTPUT = $(BUILDDIR)/libpluginbitmapsnative.a 23OUTPUT = $(BUILDDIR)/libpluginbitmapsnative.a
24BMPINCDIR = $(BUILDDIR)/pluginbitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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
21 21
22BMP2RB = $(BMP2RB_REMOTEMONO) 22BMP2RB = $(BMP2RB_REMOTEMONO)
23OUTPUT = $(BUILDDIR)/libpluginbitmapsremotemono.a 23OUTPUT = $(BUILDDIR)/libpluginbitmapsremotemono.a
24BMPINCDIR = $(BUILDDIR)/pluginbitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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
21 21
22BMP2RB = $(BMP2RB_REMOTENATIVE) 22BMP2RB = $(BMP2RB_REMOTENATIVE)
23OUTPUT = $(BUILDDIR)/libpluginbitmapsremotenative.a 23OUTPUT = $(BUILDDIR)/libpluginbitmapsremotenative.a
24BMPINCDIR = $(BUILDDIR)/pluginbitmaps
24 25
25include $(TOOLSDIR)/makebmp.inc 26include $(TOOLSDIR)/makebmp.inc
26 27
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 @@
21 21
22#include <lcd.h> 22#include <lcd.h>
23 23
24#ifdef HAVE_LCD_BITMAP
25
26/* External bitmaps */
27
28#include <rockboxlogo.h>
29#ifdef HAVE_REMOTE_LCD
30#include <remote_rockboxlogo.h>
31#endif
32
24/* 33/*
25 * Icons of size 6x8 pixels 34 * Icons of size 6x8 pixels
26 */ 35 */
27 36
28#ifdef HAVE_LCD_BITMAP
29 37
30/* Symbolic names for icons */ 38/* Symbolic names for icons */
31enum icons_5x8 { 39enum icons_5x8 {
@@ -78,45 +86,6 @@ extern const unsigned char bitmap_icons_6x8[Icon6x8Last][6];
78extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7]; 86extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7];
79extern const unsigned char bitmap_icon_disk[]; 87extern const unsigned char bitmap_icon_disk[];
80 88
81extern const fb_data rockboxlogo[];
82
83#if LCD_DEPTH == 1
84/* Archos targets */
85#define ROCKBOXLOGO_WIDTH 112
86#define ROCKBOXLOGO_HEIGHT 37
87
88#elif (LCD_WIDTH == 160) && (LCD_DEPTH == 2)
89/* iRiver H1x0 */
90#define ROCKBOXLOGO_WIDTH 160
91#define ROCKBOXLOGO_HEIGHT 53
92
93#elif (LCD_WIDTH == 160) && (LCD_DEPTH == 16)
94/* iAudio X5 */
95#define ROCKBOXLOGO_WIDTH 160
96#define ROCKBOXLOGO_HEIGHT 50
97
98#elif (LCD_WIDTH == 176) && (LCD_DEPTH == 16)
99/* iPod Nano */
100#define ROCKBOXLOGO_WIDTH 176
101#define ROCKBOXLOGO_HEIGHT 54
102
103#elif (LCD_WIDTH == 320) && (LCD_DEPTH == 16)
104/* iPod Video */
105#define ROCKBOXLOGO_WIDTH 320
106#define ROCKBOXLOGO_HEIGHT 98
107
108#elif (LCD_WIDTH >= 220) && (LCD_DEPTH == 16)
109/* iriver H3x0, iPod Color/Photo */
110#define ROCKBOXLOGO_WIDTH 220
111#define ROCKBOXLOGO_HEIGHT 68
112#endif
113
114#ifdef HAVE_REMOTE_LCD
115extern const unsigned char remote_rockboxlogo[];
116#define REMOTE_ROCKBOXLOGO_WIDTH 112
117#define REMOTE_ROCKBOXLOGO_HEIGHT 37
118#endif
119
120#define STATUSBAR_X_POS 0 89#define STATUSBAR_X_POS 0
121#define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */ 90#define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */
122#define STATUSBAR_HEIGHT 8 91#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,
412 * some #define's 412 * some #define's
413 ****************************************************************************/ 413 ****************************************************************************/
414 414
415void generate_c_source(char *id, int width, int height, 415void generate_c_source(char *id, char* header_dir, int width, int height,
416 const unsigned short *t_bitmap, int t_width, 416 const unsigned short *t_bitmap, int t_width,
417 int t_height, int t_depth) 417 int t_height, int t_depth)
418{ 418{
419 FILE *f; 419 FILE *f;
420 FILE *fh;
420 int i, a; 421 int i, a;
421 422 char header_name[1024];
422 f = stdout;
423 423
424 if (!id || !id[0]) 424 if (!id || !id[0])
425 id = "bitmap"; 425 id = "bitmap";
426 426
427 fprintf(f, 427 f = stdout;
428 "#define BMPHEIGHT_%s %ld\n" 428
429 "#define BMPWIDTH_%s %ld\n", 429 if (header_dir && header_dir[0])
430 id, height, id, width); 430 {
431 snprintf(header_name,sizeof(header_name),"%s/%s.h",header_dir,id);
432 fh = fopen(header_name,"w+");
433
434 if (fh == NULL)
435 {
436 debugf("error - can't open '%s'\n", header_name);
437 return;
438 }
439 fprintf(fh,
440 "#define BMPHEIGHT_%s %ld\n"
441 "#define BMPWIDTH_%s %ld\n",
442 id, height, id, width);
443 if (t_depth <= 8)
444 fprintf(fh, "extern const unsigned char %s[];\n", id);
445 else
446 fprintf(fh, "extern const unsigned short %s[];\n", id);
447
448 fclose(fh);
449 } else {
450 fprintf(f,
451 "#define BMPHEIGHT_%s %ld\n"
452 "#define BMPWIDTH_%s %ld\n",
453 id, height, id, width);
454 }
455
431 if (t_depth <= 8) 456 if (t_depth <= 8)
432 fprintf(f, "const unsigned char %s[] = {\n", id); 457 fprintf(f, "const unsigned char %s[] = {\n", id);
433 else 458 else
@@ -478,6 +503,7 @@ void print_usage(void)
478{ 503{
479 printf("Usage: %s [-i <id>] [-a] <bitmap file>\n" 504 printf("Usage: %s [-i <id>] [-a] <bitmap file>\n"
480 "\t-i <id> Bitmap name (default is filename without extension)\n" 505 "\t-i <id> Bitmap name (default is filename without extension)\n"
506 "\t-h <dir> Create header file in <dir>/<id>.h\n"
481 "\t-a Show ascii picture of bitmap\n" 507 "\t-a Show ascii picture of bitmap\n"
482 "\t-f <n> Generate destination format n, default = 0\n" 508 "\t-f <n> Generate destination format n, default = 0\n"
483 "\t 0 Archos recorder, Ondio, Gmini 120/SP, Iriver H1x0 mono\n" 509 "\t 0 Archos recorder, Ondio, Gmini 120/SP, Iriver H1x0 mono\n"
@@ -495,6 +521,7 @@ int main(int argc, char **argv)
495{ 521{
496 char *bmp_filename = NULL; 522 char *bmp_filename = NULL;
497 char *id = NULL; 523 char *id = NULL;
524 char* header_dir = NULL;
498 int i; 525 int i;
499 int ascii = false; 526 int ascii = false;
500 int format = 0; 527 int format = 0;
@@ -510,6 +537,23 @@ int main(int argc, char **argv)
510 { 537 {
511 switch (argv[i][1]) 538 switch (argv[i][1])
512 { 539 {
540 case 'h': /* .h filename */
541 if (argv[i][2])
542 {
543 header_dir = &argv[i][2];
544 }
545 else if (argc > i+1)
546 {
547 header_dir = argv[i+1];
548 i++;
549 }
550 else
551 {
552 print_usage();
553 exit(1);
554 }
555 break;
556
513 case 'i': /* ID */ 557 case 'i': /* ID */
514 if (argv[i][2]) 558 if (argv[i][2])
515 { 559 {
@@ -600,7 +644,8 @@ int main(int argc, char **argv)
600 if (transform_bitmap(bitmap, width, height, format, &t_bitmap, 644 if (transform_bitmap(bitmap, width, height, format, &t_bitmap,
601 &t_width, &t_height, &t_depth)) 645 &t_width, &t_height, &t_depth))
602 exit(1); 646 exit(1);
603 generate_c_source(id, width, height, t_bitmap, t_width, t_height, t_depth); 647 generate_c_source(id, header_dir, width, height, t_bitmap,
648 t_width, t_height, t_depth);
604 } 649 }
605 650
606 return 0; 651 return 0;