diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-01-29 18:23:26 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-01-29 18:23:26 +0300 |
commit | ef981e13213f882ecccd39dd043f38052eabc5a0 (patch) | |
tree | 8e5b807f52138c9bd471b1b6be55f9861b35dccf /source/blender/imbuf/intern | |
parent | e544723e639f93473bfaf2f07179f33bb5daf6d6 (diff) |
Bugfix #3797: 24-bit BMP images weren't read properly. Standard apparently
assumes each raster line is padded to a multiple of 4 bytes.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index e86507ff103..c14819c8bdf 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -152,13 +152,18 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, int size, int flags) } } else if (depth == 24) { - for (i = x * y; i > 0; i--) { - rect[0] = bmp[2]; - rect[1] = bmp[1]; - rect[2] = bmp[0]; - - rect[3] = 255; - rect += 4; bmp += 3; + for (i = y; i > 0; i--) { + int j; + for (j = x ; j > 0; j--) { + rect[0] = bmp[2]; + rect[1] = bmp[1]; + rect[2] = bmp[0]; + + rect[3] = 255; + rect += 4; bmp += 3; + } + /* for 24-bit images, rows are padded to multiples of 4 */ + bmp += x % 4; } } else if (depth == 32) { for (i = x * y; i > 0; i--) { |