diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-08-03 20:57:06 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-08-03 20:57:06 +0000 |
commit | 85890b88df7d4cc315167409e6364418e5348324 (patch) | |
tree | 636e2874c66355db15f2ef45231294ed504e039f /apps/plugins | |
parent | 0830339e2f5831575879a6194d43d2e958d8cf64 (diff) |
Const policed the grayscale lib & plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4985 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/grayscale.c | 6 | ||||
-rw-r--r-- | apps/plugins/lib/gray.h | 14 | ||||
-rw-r--r-- | apps/plugins/lib/gray_blockfuncs.c | 4 | ||||
-rw-r--r-- | apps/plugins/lib/gray_drawbitmap.c | 5 | ||||
-rw-r--r-- | apps/plugins/lib/gray_drawgraymap.c | 13 | ||||
-rw-r--r-- | apps/plugins/lib/gray_getstringsize.c | 2 | ||||
-rw-r--r-- | apps/plugins/lib/gray_pixelfuncs.c | 2 | ||||
-rw-r--r-- | apps/plugins/lib/gray_putsxy.c | 4 | ||||
-rw-r--r-- | apps/plugins/lib/gray_screendump.c | 2 |
9 files changed, 27 insertions, 25 deletions
diff --git a/apps/plugins/grayscale.c b/apps/plugins/grayscale.c index 41122c61e9..2be9cc9c23 100644 --- a/apps/plugins/grayscale.c +++ b/apps/plugins/grayscale.c @@ -42,7 +42,7 @@ int main(void) int button, scroll_amount; bool black_border; - static unsigned char rockbox[] = { + static const unsigned char rockbox[] = { /* ........................................... * .####...###...###..#...#.####...###..#...#. * .#...#.#...#.#...#.#..#..#...#.#...#..#.#.. @@ -59,7 +59,7 @@ int main(void) 0x14, 0x22, 0x00 }; - static unsigned char showing[] = { + static const unsigned char showing[] = { /* ....................................... * ..####.#...#..###..#...#.#.#...#..####. * .#.....#...#.#...#.#...#.#.##..#.#..... @@ -75,7 +75,7 @@ int main(void) 0x10, 0x3E, 0x00, 0x1C, 0x22, 0x22, 0x2A, 0x3A, 0x00 }; - static unsigned char grayscale_gray[] = { + static const unsigned char grayscale_gray[] = { /* ....................................................... * ..####.####...###..#...#..####..###...###..#.....#####. * .#.....#...#.#...#.#...#.#.....#...#.#...#.#.....#..... diff --git a/apps/plugins/lib/gray.h b/apps/plugins/lib/gray.h index c8a9afc390..52d6f6c0df 100644 --- a/apps/plugins/lib/gray.h +++ b/apps/plugins/lib/gray.h @@ -362,7 +362,7 @@ void gray_fillrect(int x, int y, int nx, int ny); This is the only drawing function NOT using the drawinfo. */ -void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, +void gray_drawgraymap(const unsigned char *src, int x, int y, int nx, int ny, int stride); /*--------------------------------------------------------------------------- @@ -384,7 +384,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, The <stride> parameter is useful if you want to show only a part of a bitmap. It should always be set to the "row length" of the bitmap. */ -void gray_drawbitmap(unsigned char *src, int x, int y, int nx, int ny, +void gray_drawbitmap(const unsigned char *src, int x, int y, int nx, int ny, int stride); /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -409,14 +409,14 @@ void gray_setfont(int newfont); This works exactly the same way as the core lcd_getstringsize(), only that it uses the selected font for grayscale. */ -int gray_getstringsize(unsigned char *str, int *w, int *h); +int gray_getstringsize(const unsigned char *str, int *w, int *h); /*--------------------------------------------------------------------------- Display text starting at (x, y) with the current font and drawinfo ---------------------------------------------------------------------------- The drawmode is used as described for gray_set_drawmode() */ -void gray_putsxy(int x, int y, unsigned char *str); +void gray_putsxy(int x, int y, const unsigned char *str); /*=========================================================================== Private functions and definitions, for use within the grayscale core only @@ -458,9 +458,9 @@ extern _tGraybuf *_graybuf; extern short _gray_random_buffer; /* Global function pointers */ -extern void (*_gray_pixelfuncs[4])(int x, int y, unsigned long pattern); -extern void (*_gray_blockfuncs[4])(unsigned char *address, unsigned mask, - unsigned bits); +extern void (* const _gray_pixelfuncs[4])(int x, int y, unsigned long pattern); +extern void (* const _gray_blockfuncs[4])(unsigned char *address, unsigned mask, + unsigned bits); #endif /* HAVE_LCD_BITMAP */ #endif /* SIMULATOR */ diff --git a/apps/plugins/lib/gray_blockfuncs.c b/apps/plugins/lib/gray_blockfuncs.c index 47ff1672a8..5f4f90506f 100644 --- a/apps/plugins/lib/gray_blockfuncs.c +++ b/apps/plugins/lib/gray_blockfuncs.c @@ -36,8 +36,8 @@ static void _writeblockfg(unsigned char *address, unsigned mask, unsigned bits); static void _writeblockbg(unsigned char *address, unsigned mask, unsigned bits); /* Block function pointer array */ -void (*_gray_blockfuncs[4])(unsigned char *address, unsigned mask, - unsigned bits) = { +void (* const _gray_blockfuncs[4])(unsigned char *address, unsigned mask, + unsigned bits) = { _invertblock, _writeblockfg, _writeblockbg, _writeblock }; diff --git a/apps/plugins/lib/gray_drawbitmap.c b/apps/plugins/lib/gray_drawbitmap.c index 5ddb19568a..376f76d45e 100644 --- a/apps/plugins/lib/gray_drawbitmap.c +++ b/apps/plugins/lib/gray_drawbitmap.c @@ -48,12 +48,13 @@ The <stride> parameter is useful if you want to show only a part of a bitmap. It should always be set to the "row length" of the bitmap. */ -void gray_drawbitmap(unsigned char *src, int x, int y, int nx, int ny, +void gray_drawbitmap(const unsigned char *src, int x, int y, int nx, int ny, int stride) { int shift; unsigned bits, mask_top, mask_bottom; - unsigned char *src_col, *dst, *dst_col; + const unsigned char *src_col; + unsigned char *dst, *dst_col; void (*blockfunc)(unsigned char *address, unsigned mask, unsigned bits); if ((unsigned) x >= (unsigned) _graybuf->width diff --git a/apps/plugins/lib/gray_drawgraymap.c b/apps/plugins/lib/gray_drawgraymap.c index dc33446527..c8ee93fef1 100644 --- a/apps/plugins/lib/gray_drawgraymap.c +++ b/apps/plugins/lib/gray_drawgraymap.c @@ -30,16 +30,16 @@ #include "gray.h" /* Prototypes */ -static void _writearray(unsigned char *address, unsigned char *src, int stride, - unsigned mask); +static void _writearray(unsigned char *address, const unsigned char *src, + int stride, unsigned mask); /* Write an 8-pixel block, defined by their brightnesses in a graymap. * Address is the byte in the first bitplane, src is the graymap start address, * stride is the increment for the graymap to get to the next pixel, mask * determines which pixels of the destination block are changed. For "0" bits, * the src address is not incremented! */ -static void _writearray(unsigned char *address, unsigned char *src, int stride, - unsigned mask) +static void _writearray(unsigned char *address, const unsigned char *src, + int stride, unsigned mask) { unsigned long pat_stack[8]; register unsigned char *end_addr; @@ -217,12 +217,13 @@ asm ( This is the only drawing function NOT using the drawinfo. */ -void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, +void gray_drawgraymap(const unsigned char *src, int x, int y, int nx, int ny, int stride) { int shift; unsigned mask_top, mask_bottom; - unsigned char *src_row, *dst, *dst_row; + const unsigned char *src_row; + unsigned char *dst, *dst_row; if ((unsigned) x >= (unsigned) _graybuf->width || (unsigned) y >= (unsigned) _graybuf->height) diff --git a/apps/plugins/lib/gray_getstringsize.c b/apps/plugins/lib/gray_getstringsize.c index 977b912247..5b6d3e7c49 100644 --- a/apps/plugins/lib/gray_getstringsize.c +++ b/apps/plugins/lib/gray_getstringsize.c @@ -36,7 +36,7 @@ This works exactly the same way as the core lcd_getstringsize(), only that it uses the selected font for grayscale. */ -int gray_getstringsize(unsigned char *str, int *w, int *h) +int gray_getstringsize(const unsigned char *str, int *w, int *h) { int ch; int width = 0; diff --git a/apps/plugins/lib/gray_pixelfuncs.c b/apps/plugins/lib/gray_pixelfuncs.c index cade096405..3cdcccd9a5 100644 --- a/apps/plugins/lib/gray_pixelfuncs.c +++ b/apps/plugins/lib/gray_pixelfuncs.c @@ -34,7 +34,7 @@ static void _writepixel(int x, int y, unsigned long pattern); static void _invertpixel(int x, int y, unsigned long pattern); /* function pointer array */ -void (*_gray_pixelfuncs[4])(int x, int y, unsigned long pattern) = { +void (* const _gray_pixelfuncs[4])(int x, int y, unsigned long pattern) = { _invertpixel, _writepixel, _writepixel, _writepixel }; diff --git a/apps/plugins/lib/gray_putsxy.c b/apps/plugins/lib/gray_putsxy.c index 18cf2bac78..51f1ca166a 100644 --- a/apps/plugins/lib/gray_putsxy.c +++ b/apps/plugins/lib/gray_putsxy.c @@ -34,7 +34,7 @@ ---------------------------------------------------------------------------- The drawmode is used as described for gray_set_drawmode() */ -void gray_putsxy(int x, int y, unsigned char *str) +void gray_putsxy(int x, int y, const unsigned char *str) { int ch, width; bitmap_t *bits; @@ -56,7 +56,7 @@ void gray_putsxy(int x, int y, unsigned char *str) bits = pf->bits + (pf->offset ? pf->offset[ch] : MULU16(pf->height, ch)); - gray_drawbitmap((unsigned char*) bits, x, y, width, pf->height, + gray_drawbitmap((const unsigned char*) bits, x, y, width, pf->height, width); x += width; } diff --git a/apps/plugins/lib/gray_screendump.c b/apps/plugins/lib/gray_screendump.c index 8968007039..fdc88b8547 100644 --- a/apps/plugins/lib/gray_screendump.c +++ b/apps/plugins/lib/gray_screendump.c @@ -29,7 +29,7 @@ #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ #include "gray.h" -static unsigned char bmpheader[] = +static const unsigned char bmpheader[] = { 0x42, 0x4d, 0xba, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x40, 0x00, |