summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-01-29 09:58:53 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-01-29 09:58:53 +0000
commit3722a99dd4f10425bd09b28b05b2bfe9f90fdd4f (patch)
treefd011912c6ef4fc46b25a84270daaf7cfbd9480f
parent8f0740333be6cf191a9faa70f43e7b334f3fa66f (diff)
downloadrockbox-3722a99dd4f10425bd09b28b05b2bfe9f90fdd4f.tar.gz
rockbox-3722a99dd4f10425bd09b28b05b2bfe9f90fdd4f.zip
Better working fix for the BMP loader transparency flag bug
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8481 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/bmp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 2e377df0ed..806d97081b 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -127,7 +127,15 @@ int read_bmp_file(char* filename,
127 127
128#if LCD_DEPTH == 1 128#if LCD_DEPTH == 1
129 (void)format; 129 (void)format;
130#else
131 bool transparent;
132
133 if(format & FORMAT_TRANSPARENT) {
134 transparent = true;
135 format &= ~FORMAT_TRANSPARENT;
136 }
130#endif 137#endif
138
131 139
132 fd = open(filename, O_RDONLY); 140 fd = open(filename, O_RDONLY);
133 141
@@ -175,7 +183,7 @@ int read_bmp_file(char* filename,
175 PaddedWidth = (width * depth / 8 + 3) & ~3; 183 PaddedWidth = (width * depth / 8 + 3) & ~3;
176 184
177#if LCD_DEPTH > 1 185#if LCD_DEPTH > 1
178 if(format & FORMAT_ANY) { 186 if(format == FORMAT_ANY) {
179 if(depth == 1) 187 if(depth == 1)
180 format = FORMAT_MONO; 188 format = FORMAT_MONO;
181 else 189 else
@@ -184,7 +192,7 @@ int read_bmp_file(char* filename,
184#endif 192#endif
185 193
186 /* PaddedHeight is for rockbox format. */ 194 /* PaddedHeight is for rockbox format. */
187 if(format & FORMAT_MONO) { 195 if(format == FORMAT_MONO) {
188 PaddedHeight = (height + 7) / 8; 196 PaddedHeight = (height + 7) / 8;
189 totalsize = PaddedHeight * width; 197 totalsize = PaddedHeight * width;
190 } else { 198 } else {
@@ -230,7 +238,7 @@ int read_bmp_file(char* filename,
230 lseek(fd, (off_t)readlong(&fh.OffBits), SEEK_SET); 238 lseek(fd, (off_t)readlong(&fh.OffBits), SEEK_SET);
231 239
232#if LCD_DEPTH == 2 240#if LCD_DEPTH == 2
233 if(format & FORMAT_NATIVE) 241 if(format == FORMAT_NATIVE)
234 memset(bitmap, 0, width * height / 4); 242 memset(bitmap, 0, width * height / 4);
235#endif 243#endif
236 244
@@ -254,7 +262,7 @@ int read_bmp_file(char* filename,
254 switch(depth) { 262 switch(depth) {
255 case 1: 263 case 1:
256#if LCD_DEPTH > 1 264#if LCD_DEPTH > 1
257 if(format & FORMAT_MONO) { 265 if(format == FORMAT_MONO) {
258#endif 266#endif
259 /* Mono -> Mono */ 267 /* Mono -> Mono */
260 for (col = 0; col < width; col++) { 268 for (col = 0; col < width; col++) {
@@ -299,7 +307,7 @@ int read_bmp_file(char* filename,
299 case 24: 307 case 24:
300 p = bmpbuf; 308 p = bmpbuf;
301#if LCD_DEPTH > 1 309#if LCD_DEPTH > 1
302 if(format & FORMAT_MONO) { 310 if(format == FORMAT_MONO) {
303#endif 311#endif
304 /* RGB24 -> mono */ 312 /* RGB24 -> mono */
305 for (col = 0; col < width; col++) { 313 for (col = 0; col < width; col++) {