From 638dd6786a75e5d3e87a9e04f80138d80665f230 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 19 Jul 2004 21:46:37 +0000 Subject: Const'ed the logo, the bitmaps and the credits (optimization for running from ROM) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4896 a1c6a512-1295-4272-9138-f99709370657 --- apps/credits.c | 2 +- apps/filetypes.c | 2 +- apps/filetypes.h | 4 ++-- apps/playlist_viewer.c | 4 ---- apps/plugin.h | 4 ++-- apps/recorder/icons.c | 10 +++++----- apps/recorder/icons.h | 10 +++++----- apps/tree.c | 4 +--- firmware/drivers/lcd-recorder.c | 11 ++++++----- firmware/export/lcd.h | 4 ++-- 10 files changed, 25 insertions(+), 30 deletions(-) diff --git a/apps/credits.c b/apps/credits.c index 71d77a6feb..9ab14345fa 100644 --- a/apps/credits.c +++ b/apps/credits.c @@ -24,7 +24,7 @@ #include "button.h" #include "sprintf.h" -char* credits[] = { +char* const credits[] = { #include "credits.raw" /* generated list of names from docs/CREDITS */ }; diff --git a/apps/filetypes.c b/apps/filetypes.c index b7004f58db..cab9618f36 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -136,7 +136,7 @@ void filetype_init(void) /* get icon */ #ifdef HAVE_LCD_BITMAP -char* filetype_get_icon(int attr) +const char* filetype_get_icon(int attr) #else int filetype_get_icon(int attr) #endif diff --git a/apps/filetypes.h b/apps/filetypes.h index 22668fd725..c5bccf4498 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -25,7 +25,7 @@ int filetype_get_attr(char*); #ifdef HAVE_LCD_BITMAP -char* filetype_get_icon(int); +const char* filetype_get_icon(int); #else int filetype_get_icon(int); #endif @@ -37,7 +37,7 @@ int filetype_load_plugin(char*,char*); struct file_type { #ifdef HAVE_LCD_BITMAP - unsigned char* icon; /* the icon which shall be used for it, NULL if unknown */ + const unsigned char* icon; /* the icon which shall be used for it, NULL if unknown */ #else int icon; /* the icon which shall be used for it, -1 if unknown */ #endif diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index b7e81eeac6..c30daf48ba 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -118,10 +118,6 @@ static struct playlist_entry tracks[MAX_PLAYLIST_ENTRIES]; /* Used when viewing playlists on disk */ static struct playlist_info temp_playlist; -#ifdef HAVE_LCD_BITMAP -extern unsigned char bitmap_icons_6x8[LastIcon][6]; -#endif - static bool initialize(char* filename, bool reload); static void load_playlist_entries(int start_index); static void load_playlist_entries_r(int end_index); diff --git a/apps/plugin.h b/apps/plugin.h index 659e6dbda3..085cccfc6b 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -120,8 +120,8 @@ struct plugin_api { void (*lcd_unlock_pattern)(unsigned char pat); void (*lcd_putc)(int x, int y, unsigned short ch); #else - void (*lcd_putsxy)(int x, int y, unsigned char *string); - void (*lcd_bitmap)(unsigned char *src, int x, int y, + void (*lcd_putsxy)(int x, int y, const unsigned char *string); + void (*lcd_bitmap)(const unsigned char *src, int x, int y, int nx, int ny, bool clear); void (*lcd_drawline)(int x1, int y1, int x2, int y2); void (*lcd_clearline)(int x1, int y1, int x2, int y2); diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index b831e59f53..41e584ed35 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c @@ -28,7 +28,7 @@ #include "icons.h" -unsigned char slider_bar[] = +const unsigned char slider_bar[] = { 0x38, 0x28, 0x28, 0x28, 0x28, 0x7c, 0x28, 0x28, 0x28, 0x28, @@ -40,13 +40,13 @@ unsigned char slider_bar[] = 0x7c, 0x28, 0x28, 0x28, 0x28, 0x38 }; -unsigned char bitmap_icons_5x8[][5] = +const unsigned char bitmap_icons_5x8[][5] = { /* Lock */ {0x78,0x7f,0x49,0x7f,0x78} }; -unsigned char bitmap_icons_6x8[LastIcon][6] = +const unsigned char bitmap_icons_6x8[LastIcon][6] = { { 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f }, /* Box_Filled */ { 0x00, 0x7f, 0x41, 0x41, 0x41, 0x7f }, /* Box_Empty */ @@ -67,7 +67,7 @@ unsigned char bitmap_icons_6x8[LastIcon][6] = { 0xff, 0x81, 0xaf, 0xaa, 0x8c, 0xf8 }, /* Bookmark file */ }; -unsigned char bitmap_icons_7x8[][7] = +const unsigned char bitmap_icons_7x8[][7] = { {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ {0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00}, /* Speaker */ @@ -86,7 +86,7 @@ unsigned char bitmap_icons_7x8[][7] = {0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */ }; -unsigned char rockbox112x37[]={ +const unsigned char rockbox112x37[]={ 0x00, 0x00, 0x02, 0xff, 0x02, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0x7c, 0x7d, 0xfd, 0xfa, 0xfa, 0xf4, 0xe8, 0x90, 0x60, 0x80, 0xe0, 0x10, 0xc8, diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index afea0b1ae4..cf7687e0bd 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h @@ -60,13 +60,13 @@ enum icons_7x8 { Icon_Last }; -extern unsigned char bitmap_icons_5x8[1][5]; -extern unsigned char bitmap_icons_6x8[LastIcon][6]; -extern unsigned char bitmap_icons_7x8[Icon_Last][7]; +extern const unsigned char bitmap_icons_5x8[1][5]; +extern const unsigned char bitmap_icons_6x8[LastIcon][6]; +extern const unsigned char bitmap_icons_7x8[Icon_Last][7]; -extern unsigned char rockbox112x37[]; +extern const unsigned char rockbox112x37[]; -extern unsigned char slider_bar[]; +extern const unsigned char slider_bar[]; #define STATUSBAR_X_POS 0 #define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */ diff --git a/apps/tree.c b/apps/tree.c index 988e6b3d93..754e84f508 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -163,8 +163,6 @@ void tree_get_filetypes(struct filetype** types, int* count) #define SCROLLBAR_Y lcd_getymargin() #define SCROLLBAR_WIDTH 6 -extern unsigned char bitmap_icons_6x8[LastIcon][6]; - #else /* HAVE_LCD_BITMAP */ #define TREE_MAX_ON_SCREEN 2 @@ -461,7 +459,7 @@ static int showdir(char *path, int start, int *dirfilter) bool dir_buffer_full; #ifdef HAVE_LCD_BITMAP - char* icon; + const char* icon; int line_height; int fw, fh; lcd_setfont(FONT_UI); diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index cf3c7615e1..3d3763ca50 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -371,7 +371,7 @@ void lcd_puts_style(int x, int y, unsigned char *str, int style) } /* put a string at a given pixel position, skipping first ofs pixel columns */ -static void lcd_putsxyofs(int x, int y, int ofs, unsigned char *str) +static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) { int ch; struct font* pf = font_get(curfont); @@ -428,7 +428,7 @@ static void lcd_putsxyofs(int x, int y, int ofs, unsigned char *str) } /* put a string at a given pixel position */ -void lcd_putsxy(int x, int y, unsigned char *str) +void lcd_putsxy(int x, int y, const unsigned char *str) { lcd_putsxyofs(x, y, 0, str); } @@ -450,12 +450,13 @@ void lcd_putsxy(int x, int y, unsigned char *str) * Draw a bitmap at (x, y), size (nx, ny) * if 'clear' is true, clear destination area first */ -void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, +void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny, bool clear) __attribute__ ((section (".icode"))); -void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, +void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny, bool clear) { - unsigned char *src_col, *dst, *dst_col; + const unsigned char *src_col; + unsigned char *dst, *dst_col; unsigned int data, mask1, mask2, mask3, mask4; int stride, shift; diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 20023bf1c6..1a408d448c 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -123,7 +123,7 @@ extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; extern void lcd_setmargins(int xmargin, int ymargin); extern int lcd_getxmargin(void); extern int lcd_getymargin(void); -extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, +extern void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny, bool clear); extern void lcd_clearrect (int x, int y, int nx, int ny); extern void lcd_fillrect (int x, int y, int nx, int ny); @@ -141,7 +141,7 @@ extern void lcd_set_flip(bool yesno); extern void lcd_bidir_scroll(int threshold); extern void lcd_scroll_step(int pixels); extern void lcd_setfont(int font); -extern void lcd_putsxy(int x, int y, unsigned char *string); +extern void lcd_putsxy(int x, int y, const unsigned char *string); extern int lcd_getstringsize(unsigned char *str, int *w, int *h); extern int lcd_getstringsize(unsigned char *str, int *w, int *h); -- cgit v1.2.3