summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-08-03 20:57:06 +0000
committerJens Arnold <amiconn@rockbox.org>2004-08-03 20:57:06 +0000
commit85890b88df7d4cc315167409e6364418e5348324 (patch)
tree636e2874c66355db15f2ef45231294ed504e039f /apps/plugins/lib
parent0830339e2f5831575879a6194d43d2e958d8cf64 (diff)
downloadrockbox-85890b88df7d4cc315167409e6364418e5348324.zip
rockbox-85890b88df7d4cc315167409e6364418e5348324.tar.gz
rockbox-85890b88df7d4cc315167409e6364418e5348324.tar.bz2
rockbox-85890b88df7d4cc315167409e6364418e5348324.tar.xz
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/lib')
-rw-r--r--apps/plugins/lib/gray.h14
-rw-r--r--apps/plugins/lib/gray_blockfuncs.c4
-rw-r--r--apps/plugins/lib/gray_drawbitmap.c5
-rw-r--r--apps/plugins/lib/gray_drawgraymap.c13
-rw-r--r--apps/plugins/lib/gray_getstringsize.c2
-rw-r--r--apps/plugins/lib/gray_pixelfuncs.c2
-rw-r--r--apps/plugins/lib/gray_putsxy.c4
-rw-r--r--apps/plugins/lib/gray_screendump.c2
8 files changed, 24 insertions, 22 deletions
diff --git a/apps/plugins/lib/gray.h b/apps/plugins/lib/gray.h
index c8a9afc..52d6f6c 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 47ff167..5f4f905 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 5ddb195..376f76d 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 dc33446..c8ee93f 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 977b912..5b6d3e7 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 cade096..3cdcccd 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 18cf2ba..51f1ca1 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 8968007..fdc88b8 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,