// Purpose: wxImage handler for Amiga IFF images
// Author: Steffen Gutmann, Thomas Meyer
// RCS-ID: $Id$
// Purpose: wxImage handler for Amiga IFF images
// Author: Steffen Gutmann, Thomas Meyer
// RCS-ID: $Id$
// constructor, destructor, etc.
wxIFFDecoder(wxInputStream *s);
~wxIFFDecoder() { Destroy(); }
// constructor, destructor, etc.
wxIFFDecoder(wxInputStream *s);
~wxIFFDecoder() { Destroy(); }
return (memcmp(buf, "FORM", 4) == 0) && (memcmp(buf+8, "ILBM", 4) == 0);
}
return (memcmp(buf, "FORM", 4) == 0) && (memcmp(buf+8, "ILBM", 4) == 0);
}
- void decomprle(source, destination, source length, buffer size)
+void decomprle(source, destination, source length, buffer size)
- Decompress run-length encoded data from source to destination. Terminates
- when source is decoded completely or destination buffer is full.
+Decompress run-length encoded data from source to destination. Terminates
+when source is decoded completely or destination buffer is full.
- The decruncher is as optimized as I could make it, without risking
- safety in case of corrupt BODY chunks.
+The decruncher is as optimized as I could make it, without risking
+safety in case of corrupt BODY chunks.
**************************************************************************/
static void decomprle(const byte *sptr, byte *dptr, long slen, long dlen)
**************************************************************************/
static void decomprle(const byte *sptr, byte *dptr, long slen, long dlen)
}
// check if we really got an IFF file
if (strncmp((char *)dataptr, "FORM", 4) != 0) {
}
// check if we really got an IFF file
if (strncmp((char *)dataptr, "FORM", 4) != 0) {
}
dataptr = dataptr + 8; // skip ID and length of FORM
// check if the IFF file is an ILBM (picture) file
if (strncmp((char *) dataptr, "ILBM", 4) != 0) {
}
dataptr = dataptr + 8; // skip ID and length of FORM
// check if the IFF file is an ILBM (picture) file
if (strncmp((char *) dataptr, "ILBM", 4) != 0) {
// get chunk length and make even
long chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe;
if (chunkLen < 0) { // format error?
// get chunk length and make even
long chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe;
if (chunkLen < 0) { // format error?
decomprle(bodyptr, decomp_mem, chunkLen, decomp_bufsize);
bodyptr = decomp_mem; // -> uncompressed BODY
chunkLen = decomp_bufsize;
decomprle(bodyptr, decomp_mem, chunkLen, decomp_bufsize);
bodyptr = decomp_mem; // -> uncompressed BODY
chunkLen = decomp_bufsize;
- wxLogTrace(_T("iff"),
- _T("LoadIFF: %s %dx%d, planes=%d (%d cols), comp=%d"),
+ wxLogTrace(wxT("iff"),
+ wxT("LoadIFF: %s %dx%d, planes=%d (%d cols), comp=%d"),
(fmt==ILBM_NORMAL) ? "Normal ILBM" :
(fmt==ILBM_HAM) ? "HAM ILBM" :
(fmt==ILBM_HAM8) ? "HAM8 ILBM" :
(fmt==ILBM_NORMAL) ? "Normal ILBM" :
(fmt==ILBM_HAM) ? "HAM ILBM" :
(fmt==ILBM_HAM8) ? "HAM8 ILBM" :
1<<bmhd_bitplanes, bmhd_compression);
if ((fmt==ILBM_NORMAL) || (fmt==ILBM_EHB) || (fmt==ILBM_HAM)) {
1<<bmhd_bitplanes, bmhd_compression);
if ((fmt==ILBM_NORMAL) || (fmt==ILBM_EHB) || (fmt==ILBM_HAM)) {
*dataptr, *(dataptr+1), *(dataptr+2), *(dataptr+3));
dataptr = dataptr + 8 + chunkLen; // skip unknown chunk
*dataptr, *(dataptr+1), *(dataptr+2), *(dataptr+3));
dataptr = dataptr + 8 + chunkLen; // skip unknown chunk