summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-05-16 12:48:38 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-05-16 12:48:38 +0000
commit05fcd0b0e2958d47f9463dfca978ad904faaa282 (patch)
tree14f517d7aee8fddcb5aa63a7827cb0375b61befb /uisimulator
parenteae6296b5673705bf49c119b6fa4b456a6909a3b (diff)
downloadrockbox-05fcd0b0e2958d47f9463dfca978ad904faaa282.tar.gz
rockbox-05fcd0b0e2958d47f9463dfca978ad904faaa282.zip
this works with an 8bit indexed uncompressed BMP
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@584 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/bmp.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/uisimulator/bmp.c b/uisimulator/bmp.c
index 5df003a537..404869fcf2 100644
--- a/uisimulator/bmp.c
+++ b/uisimulator/bmp.c
@@ -107,7 +107,7 @@ int read_bmp_file(char* filename,
long size;
unsigned int row, col, byte, bit;
int l;
- char *bmp;
+ unsigned char *bmp;
int width;
int height;
@@ -179,8 +179,12 @@ int read_bmp_file(char* filename,
background = 1;
}
- width = readlong(fh.Width)*readshort(fh.BitCount);
- PaddedWidth = ((width+31)&(~0x1f))/8;
+ /* width = readlong(fh.Width)*readshort(fh.BitCount); */
+
+ width = readlong(fh.Width);
+
+ /* PaddedWidth = ((width+31)&(~0x1f))/8; */
+ PaddedWidth = ((width+7)&(~0x7));
size = PaddedWidth*readlong(fh.Height);
bmp = (unsigned char *)malloc(size);
@@ -231,13 +235,14 @@ int read_bmp_file(char* filename,
#else
/* Now convert the bitmap into an array with 1 byte per pixel,
exactly the size of the image */
+
for(row = 0;row < bitmap_height;row++) {
for(col = 0;col < bitmap_width;col++) {
- if(bmp[(bitmap_height - row) * PaddedWidth]) {
- bitmap[ (row/8) * bitmap_width + col ] |= 1<<(row&7);
+ if(bmp[(bitmap_height-1 -row) * PaddedWidth + col]) {
+ bitmap[ (row/8) * bitmap_width + col ] &= ~ (1<<(row&7));
}
else {
- bitmap[ (row/8) * bitmap_width + col ] &= ~ 1<<(row&7);
+ bitmap[ (row/8) * bitmap_width + col ] |= 1<<(row&7);
}
}
}