Re: [AD] Additional functionality for load_bmp |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> I've had a few complaints from some people using my software that it won't
> import some BMP files. I did a little investigation and it turns out these
> files use the BI_BITFIELDS compression type, which Allegro doesn't
> support.
I guess we need to add the support then.
> The attached patch adds support for 15-bit, 16-bit and 32-bit BMP files of
> this type (according to MSDN, I think these are the only colour depths
> that use this type). It works with the two files I have to test it with,
> so if you approve please do add it to allegro.
Build your patches with diff -up (or diff -cp), it's much more readable.
A few remarks:
- the formatting doesn't follow Allegro's coding style (see ahack.html),
- no mixed-case identifiers: bytesPerPixel should be bytes_per_pixel,
- no C++-style comment,
+ bpp = bitmap_color_depth(bmp);
+
+ if (bpp == 15)
+ bytesPerPixel = 2;
+ else
+ bytesPerPixel = bpp / 8;
We have a macro for this: BYTES_PER_PIXEL() from aintern.h .
Otherwise, the patch looks good. Would you mind doing the corrections I
suggested and submitting the result? Thanks in advance.
--
Eric Botcazou