[AD] Possible bug in load_bmp |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I have Allegro version 3.12 compiled with DJGPP 2.02 and when I use
examples\ex15.exe to visualize some 16-colour RLE4-encoded bitmaps it
doesn't work like it should.
I don't know if it's really a bug, but other programs like ACDSee 32
v2.41, Display v1.90-t3 or even Microsoft Paint Windows 98 display that
kind of bitmaps well.
One of those bitmaps is attached for you to test it. This bitmap
has been generated by resizing and quantizing a bigger image with
Display v1.90-t3.
Later, looking around bmp.c, I've discovered that when reading RLE8 and
RLE4 compressed bitmaps, there's a check for the position being higher
than line width which skips the reading of the end of line escape code
(00 00). I don't know if such check is correct, but as the position
increments after each pixel, I've changed the if condition to check for
position - 1. I've tried it on several RLE4 and RLE8 BMPs and seems to
work for me, but I'm not sure if it'll work for all bitmaps. The changes
I made are on the patch file I'm sending, which has been generated using
GNU Diff 2.7 with no extra options.
Thanks.
--
Paco
------------------------------------------------------------------------
\//ally/TLOTB^Inside wally@xxxxxxxxxx
372c372
< if (pos > (int)infoheader->biWidth)
---
> if ((pos - 1) > (int)infoheader->biWidth)
450c450
< if (pos > (int)infoheader->biWidth)
---
> if ((pos - 1) > (int)infoheader->biWidth)