1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Linus Nielsen Feltzing 2006-01-29 09:58:53 +00:00
parent 8f0740333b
commit 3722a99dd4

View file

@ -127,8 +127,16 @@ int read_bmp_file(char* filename,
#if LCD_DEPTH == 1 #if LCD_DEPTH == 1
(void)format; (void)format;
#else
bool transparent;
if(format & FORMAT_TRANSPARENT) {
transparent = true;
format &= ~FORMAT_TRANSPARENT;
}
#endif #endif
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
/* Exit if file opening failed */ /* Exit if file opening failed */
@ -175,7 +183,7 @@ int read_bmp_file(char* filename,
PaddedWidth = (width * depth / 8 + 3) & ~3; PaddedWidth = (width * depth / 8 + 3) & ~3;
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if(format & FORMAT_ANY) { if(format == FORMAT_ANY) {
if(depth == 1) if(depth == 1)
format = FORMAT_MONO; format = FORMAT_MONO;
else else
@ -184,7 +192,7 @@ int read_bmp_file(char* filename,
#endif #endif
/* PaddedHeight is for rockbox format. */ /* PaddedHeight is for rockbox format. */
if(format & FORMAT_MONO) { if(format == FORMAT_MONO) {
PaddedHeight = (height + 7) / 8; PaddedHeight = (height + 7) / 8;
totalsize = PaddedHeight * width; totalsize = PaddedHeight * width;
} else { } else {
@ -230,7 +238,7 @@ int read_bmp_file(char* filename,
lseek(fd, (off_t)readlong(&fh.OffBits), SEEK_SET); lseek(fd, (off_t)readlong(&fh.OffBits), SEEK_SET);
#if LCD_DEPTH == 2 #if LCD_DEPTH == 2
if(format & FORMAT_NATIVE) if(format == FORMAT_NATIVE)
memset(bitmap, 0, width * height / 4); memset(bitmap, 0, width * height / 4);
#endif #endif
@ -254,7 +262,7 @@ int read_bmp_file(char* filename,
switch(depth) { switch(depth) {
case 1: case 1:
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if(format & FORMAT_MONO) { if(format == FORMAT_MONO) {
#endif #endif
/* Mono -> Mono */ /* Mono -> Mono */
for (col = 0; col < width; col++) { for (col = 0; col < width; col++) {
@ -299,7 +307,7 @@ int read_bmp_file(char* filename,
case 24: case 24:
p = bmpbuf; p = bmpbuf;
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if(format & FORMAT_MONO) { if(format == FORMAT_MONO) {
#endif #endif
/* RGB24 -> mono */ /* RGB24 -> mono */
for (col = 0; col < width; col++) { for (col = 0; col < width; col++) {