summaryrefslogtreecommitdiff
path: root/gutils
diff options
context:
space:
mode:
authorpfaedit <pfaedit>2008-09-05 02:05:27 +0000
committerpfaedit <pfaedit>2008-09-05 02:05:27 +0000
commitee58bbd32cc5b98fccbb60e678fb86f85e4b6a47 (patch)
tree6ca3b9c72063f47f880bd910efd9469b6c200c9b /gutils
parent47014731f1e0e1a6ccc5f39bd6cc7e9ae4322676 (diff)
Someone handed me a 32bit per pixel bmp with a compression of 0. A combination which does not appear to be documented in the sources available to me (gimp crashes on it). However it's easy to guess what should be done, and the guess appears to work in this case.
Diffstat (limited to 'gutils')
-rw-r--r--gutils/gimagereadbmp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gutils/gimagereadbmp.c b/gutils/gimagereadbmp.c
index 8c523b09..2b8d35fe 100644
--- a/gutils/gimagereadbmp.c
+++ b/gutils/gimagereadbmp.c
@@ -90,7 +90,7 @@ return 0; /* Bad format */
return( 0 );
if ( head->compression==3 && ( head->bitsperpixel==16 || head->bitsperpixel==32 ))
/* Good */;
- else if ( head->compression==0 && ( head->bitsperpixel<=8 || head->bitsperpixel==24 ))
+ else if ( head->compression==0 && ( head->bitsperpixel<=8 || head->bitsperpixel==24 || head->bitsperpixel==32 ))
/* Good */;
else if ( head->compression==1 && head->bitsperpixel==8 )
/* Good */;
@@ -276,6 +276,18 @@ return( 0 );
for ( j=0; j<excess; ++j )
(void) getc(file); /* ignore padding */
}
+ } else if ( head->bitsperpixel==32 && head->compression==0 ) {
+ for ( i=0; i<head->height; ++i ) {
+ ii = i*head->width;
+ for ( j=0; j<head->width; ++j ) {
+ int b,g,r;
+ b = getc(file);
+ g = getc(file);
+ r = getc(file);
+ (void) getc(file); /* Ignore the alpha channel */
+ head->int32_pixels[ii+j] = COLOR_CREATE(r,g,b);
+ }
+ }
} else if ( head->bitsperpixel==16 ) {
for ( i=0; i<head->height; ++i ) {
ii = i*head->width;