GraphicsMagick: coders/bmp.c Remove 3rd condition that blocked c...
GraphicsMagick Commits <[email protected]> Sun, 20 Aug 2023 06:28:53 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.10655.1692530943.8047.graphicsmagick-commit@lists.sourceforge.net> |
changeset 0f22f88bb994 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=0f22f88bb994
summary: coders/bmp.c Remove 3rd condition that blocked correct processiong of BI_ALPHABITFIELDS compression :(.
diffstat:
coders/bmp.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (66 lines):
diff -r 0b41c94e117f -r 0f22f88bb994 coders/bmp.c
--- a/coders/bmp.c Sun Aug 20 12:24:14 2023 +0200
+++ b/coders/bmp.c Sun Aug 20 13:28:26 2023 +0200
@@ -1236,7 +1236,8 @@
We do this before allocating raster memory to avoid DOS.
*/
if ((bmp_info.compression == BI_RGB) ||
- (bmp_info.compression == BI_BITFIELDS))
+ (bmp_info.compression == BI_BITFIELDS) ||
+ (bmp_info.compression == BI_ALPHABITFIELDS))
{
/*
Not compressed.
@@ -1270,7 +1271,8 @@
if (pixels == (unsigned char *) NULL)
ThrowBMPReaderException(ResourceLimitError,MemoryAllocationFailed,image);
if ((bmp_info.compression == BI_RGB) ||
- (bmp_info.compression == BI_BITFIELDS))
+ (bmp_info.compression == BI_BITFIELDS) ||
+ (bmp_info.compression == BI_ALPHABITFIELDS))
{
if (logging)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
@@ -1328,17 +1330,17 @@
if(bmp_info.compression == BI_RGB ||
(bmp_info.red_mask==0 && bmp_info.green_mask==0 && bmp_info.blue_mask==0 && bmp_info.alpha_mask==0))
{
- if (bmp_info.bits_per_pixel == 16) /* USE BMP 565 */
+ if (bmp_info.bits_per_pixel == 16)
{
if(bmp_info.compression==BI_ALPHABITFIELDS)
- {
+ { /* USE ARGB 1555 */
image->matte = True;
bmp_info.alpha_mask=0x00008000U;
bmp_info.red_mask=0x00007c00U;
bmp_info.green_mask=0x000003e0U;
bmp_info.blue_mask=0x0000001fU;
}
- else
+ else /* USE RGB 565 */
{
bmp_info.red_mask=0x0000F800U;
bmp_info.green_mask=0x000007e0U;
@@ -1491,7 +1493,8 @@
Convert bitfield encoded 16-bit PseudoColor scanline.
*/
if (bmp_info.compression != BI_RGB &&
- bmp_info.compression != BI_BITFIELDS)
+ bmp_info.compression != BI_BITFIELDS &&
+ bmp_info.compression != BI_ALPHABITFIELDS)
ThrowBMPReaderException(CorruptImageError,UnrecognizedImageCompression,image)
bytes_per_line=2*(image->columns+image->columns%2);
image->storage_class=DirectClass;
@@ -1586,8 +1589,9 @@
/*
Convert bitfield encoded DirectColor scanline.
*/
- if ((bmp_info.compression != BI_RGB) &&
- (bmp_info.compression != BI_BITFIELDS))
+ if(bmp_info.compression != BI_RGB &&
+ bmp_info.compression != BI_BITFIELDS &&
+ bmp_info.compression != BI_ALPHABITFIELDS)
ThrowBMPReaderException(CorruptImageError,UnrecognizedImageCompression,image)
bytes_per_line=4*(image->columns);
for (y=(long) image->rows-1; y >= 0; y--)