Update libmng snapshot. Not in default build.

git-svn-id: svn://10.0.0.236/trunk@73305 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tor%cs.brown.edu 2000-06-27 14:40:32 +00:00
parent 0d5bee3573
commit cd57a86bb7
11 changed files with 116 additions and 63 deletions

View File

@ -13,6 +13,7 @@ This is a working version only; the next release will be 0.9.0 (first Beta!)
- added an image-level parameter for the processtext callback - added an image-level parameter for the processtext callback
- updated mngplg to 0.3.0 (supports JNG & full color-correction!) - updated mngplg to 0.3.0 (supports JNG & full color-correction!)
- fixed a lot of small things - fixed a lot of small things
- added support for PPLT chunk
------------------- -------------------
@ -51,6 +52,12 @@ core:
- added support for PPLT chunk - added support for PPLT chunk
- added trace-codes & -strings for PPLT chunk processing - added trace-codes & -strings for PPLT chunk processing
- fixed problem with incorrect gamma-correction - fixed problem with incorrect gamma-correction
- fixed inclusion of IJG read/write code
- fixed problem with 16-bit GA format
- fixed problem with cheap transparency for 4-bit gray
- fixed display_xxxx routines for interlaced images
- added precaution against faulty iCCP chunks from PS
- changed userdata variable to mng_ptr
samples: samples:

View File

@ -150,6 +150,10 @@
/* * 0.5.3 - 06/21/2000 - G.Juyn * */ /* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added get/set for speedtype to facilitate testing * */ /* * - added get/set for speedtype to facilitate testing * */
/* * - added get for imagelevel during processtext callback * */ /* * - added get for imagelevel during processtext callback * */
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
/* * - fixed inclusion of IJG read/write code * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - changed userdata variable to mng_ptr * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -193,6 +197,15 @@
#define MNG_USE_SETJMP #define MNG_USE_SETJMP
#endif #endif
#ifdef MNG_INCLUDE_JNG
#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS)
#define MNG_INCLUDE_JNG_READ
#endif
#if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS)
#define MNG_INCLUDE_JNG_WRITE
#endif
#endif
#ifdef MNG_FULL_CMS #ifdef MNG_FULL_CMS
#define MNG_INCLUDE_LCMS #define MNG_INCLUDE_LCMS
#endif #endif
@ -301,7 +314,7 @@ MNG_EXT mng_uint8 MNG_DECL mng_version_release (void);
/* library initialization function */ /* library initialization function */
/* must be the first called before anything can be done at all */ /* must be the first called before anything can be done at all */
/* initializes internal datastructure(s) */ /* initializes internal datastructure(s) */
MNG_EXT mng_handle MNG_DECL mng_initialize (mng_int32 iUserdata, MNG_EXT mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
mng_memalloc fMemalloc, mng_memalloc fMemalloc,
mng_memfree fMemfree, mng_memfree fMemfree,
mng_traceproc fTraceproc); mng_traceproc fTraceproc);
@ -556,7 +569,7 @@ MNG_EXT mng_processarow MNG_DECL mng_getcb_processarow (mng_handle hHandle);
/* Application data pointer */ /* Application data pointer */
/* provided for application use; not used by the library */ /* provided for application use; not used by the library */
MNG_EXT mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, MNG_EXT mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle,
mng_int32 iUserdata); mng_ptr pUserdata);
/* The style of the drawing- & background-canvas */ /* The style of the drawing- & background-canvas */
/* only used for displaying images */ /* only used for displaying images */
@ -694,7 +707,7 @@ MNG_EXT mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle,
/* ************************************************************************** */ /* ************************************************************************** */
/* see _set_ */ /* see _set_ */
MNG_EXT mng_int32 MNG_DECL mng_get_userdata (mng_handle hHandle); MNG_EXT mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle);
/* Network Graphic header details */ /* Network Graphic header details */
/* these get filled once the graphics header is processed, /* these get filled once the graphics header is processed,

View File

@ -80,6 +80,8 @@
/* * - added administration of imagelevel parameter * */ /* * - added administration of imagelevel parameter * */
/* * 0.5.3 - 06/22/2000 - G.Juyn * */ /* * 0.5.3 - 06/22/2000 - G.Juyn * */
/* * - implemented support for PPLT chunk * */ /* * - implemented support for PPLT chunk * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - added precaution against faulty iCCP chunks from PS * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -305,7 +307,8 @@ mng_retcode inflate_buffer (mng_datap pData,
MNG_ALLOC (pData, *pOutbuf, *iOutsize) MNG_ALLOC (pData, *pOutbuf, *iOutsize)
} }
} /* repeat if we didn't have enough space */ } /* repeat if we didn't have enough space */
while (iRetcode == MNG_BUFOVERFLOW); while ((iRetcode == MNG_BUFOVERFLOW) &&
(*iOutsize < 20 * iInsize));
if (!iRetcode) /* if oke ? */ if (!iRetcode) /* if oke ? */
*((*pOutbuf) + *iRealsize) = 0; /* then put terminator zero */ *((*pOutbuf) + *iRealsize) = 0; /* then put terminator zero */

View File

@ -52,6 +52,8 @@
/* * 0.5.3 - 06/21/2000 - G.Juyn * */ /* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added Speed parameter to facilitate testing * */ /* * - added Speed parameter to facilitate testing * */
/* * - added Imagelevel parameter for processtext callback * */ /* * - added Imagelevel parameter for processtext callback * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - changed userdata variable to mng_ptr * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -169,7 +171,7 @@ typedef struct mng_data_struct {
mng_uint32 iMagic; /* magic number to validate mng_uint32 iMagic; /* magic number to validate
a given handle */ a given handle */
mng_int32 iUserdata; /* application workdata */ mng_ptr pUserdata; /* application workdata */
mng_imgtype eSigtype; /* image information */ mng_imgtype eSigtype; /* image information */
mng_imgtype eImagetype; /* initially zeroed */ mng_imgtype eImagetype; /* initially zeroed */

View File

@ -208,7 +208,7 @@ mng_retcode interframe_delay (mng_datap pData)
if (pData->iRuntime < iWaitfor) /* delay necessary ? */ if (pData->iRuntime < iWaitfor) /* delay necessary ? */
iInterval = iWaitfor - pData->iRuntime; iInterval = iWaitfor - pData->iRuntime;
else else
iInterval = 10; /* force app to process messageloop */ iInterval = 1; /* force app to process messageloop */
/* set the timer */ /* set the timer */
if (!pData->fSettimer ((mng_handle)pData, iInterval)) if (!pData->fSettimer ((mng_handle)pData, iInterval))
MNG_ERROR (pData, MNG_APPTIMERERROR) MNG_ERROR (pData, MNG_APPTIMERERROR)

View File

@ -58,6 +58,8 @@
/* * 0.5.3 - 06/21/2000 - G.Juyn * */ /* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added initialization of Speed * */ /* * - added initialization of Speed * */
/* * - added initialization of Imagelevel * */ /* * - added initialization of Imagelevel * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - changed userdata variable to mng_ptr * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -272,7 +274,7 @@ mng_uint8 MNG_DECL mng_version_release (void)
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
mng_handle MNG_DECL mng_initialize (mng_int32 iUserdata, mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata,
mng_memalloc fMemalloc, mng_memalloc fMemalloc,
mng_memfree fMemfree, mng_memfree fMemfree,
mng_traceproc fTraceproc) mng_traceproc fTraceproc)
@ -294,7 +296,7 @@ mng_handle MNG_DECL mng_initialize (mng_int32 iUserdata,
/* validate the structure */ /* validate the structure */
pData->iMagic = MNG_MAGIC; pData->iMagic = MNG_MAGIC;
/* save userdata field */ /* save userdata field */
pData->iUserdata = iUserdata; pData->pUserdata = pUserdata;
/* remember trace callback */ /* remember trace callback */
pData->fTraceproc = fTraceproc; pData->fTraceproc = fTraceproc;

View File

@ -23,6 +23,8 @@
/* * * */ /* * * */
/* * 0.5.3 - 06/17/2000 - G.Juyn * */ /* * 0.5.3 - 06/17/2000 - G.Juyn * */
/* * - added tracing of JPEG calls * */ /* * - added tracing of JPEG calls * */
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
/* * - fixed inclusion of IJG read/write code * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -55,20 +57,25 @@
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_init_source (j_decompress_ptr cinfo) void mng_init_source (j_decompress_ptr cinfo)
{ {
return; /* nothing needed */ return; /* nothing needed */
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
boolean mng_fill_input_buffer (j_decompress_ptr cinfo) boolean mng_fill_input_buffer (j_decompress_ptr cinfo)
{ {
return FALSE; /* force IJG routine to return to caller */ return FALSE; /* force IJG routine to return to caller */
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes) void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{ {
if (num_bytes > 0) /* ignore fony calls */ if (num_bytes > 0) /* ignore fony calls */
@ -93,13 +100,16 @@ void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
return; return;
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
void mng_term_source (j_decompress_ptr cinfo) void mng_term_source (j_decompress_ptr cinfo)
{ {
return; /* nothing needed */ return; /* nothing needed */
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */
@ -141,16 +151,7 @@ mng_retcode mngjpeg_initialize (mng_datap pData)
MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_START) MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_START)
#endif #endif
/* allocate space for JPEG structures if necessary */ /* allocate space for JPEG structures if necessary */
#if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS) #ifdef MNG_INCLUDE_JNG_READ
if (pData->pJPEGcerr == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
if (pData->pJPEGcinfo == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
/* enable reverse addressing */
pData->pJPEGcinfo->client_data = pData;
#endif
#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS)
if (pData->pJPEGderr == MNG_NULL) if (pData->pJPEGderr == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGderr, sizeof (mngjpeg_error )) MNG_ALLOC (pData, pData->pJPEGderr, sizeof (mngjpeg_error ))
if (pData->pJPEGdsrc == MNG_NULL) if (pData->pJPEGdsrc == MNG_NULL)
@ -160,6 +161,15 @@ mng_retcode mngjpeg_initialize (mng_datap pData)
/* enable reverse addressing */ /* enable reverse addressing */
pData->pJPEGdinfo->client_data = pData; pData->pJPEGdinfo->client_data = pData;
#endif #endif
#ifdef MNG_INCLUDE_JNG_WRITE
if (pData->pJPEGcerr == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
if (pData->pJPEGcinfo == MNG_NULL)
MNG_ALLOC (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
/* enable reverse addressing */
pData->pJPEGcinfo->client_data = pData;
#endif
/* initialize temporary buffer parms */ /* initialize temporary buffer parms */
pData->iJPEGbufmax = MNG_JPEG_MAXBUF; pData->iJPEGbufmax = MNG_JPEG_MAXBUF;
MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax) MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
@ -207,25 +217,27 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */ MNG_ERRORJ (pData, iRetcode) /* then IJG-lib issued an error */
#endif #endif
#ifdef MNG_SUPPORT_WRITE #ifdef MNG_INCLUDE_JNG_READ
if (pData->bJPEGdecompress) /* still decompressing something ? */
jpeg_destroy_decompress (pData->pJPEGdinfo);
#endif
#ifdef MNG_INCLUDE_JNG_WRITE
if (pData->bJPEGcompress) /* still compressing something ? */ if (pData->bJPEGcompress) /* still compressing something ? */
jpeg_destroy_compress (pData->pJPEGcinfo); jpeg_destroy_compress (pData->pJPEGcinfo);
#endif #endif
if (pData->bJPEGdecompress) /* still decompressing something ? */
jpeg_destroy_decompress (pData->pJPEGdinfo);
#endif /* MNG_INCLUDE_IJG6B */ #endif /* MNG_INCLUDE_IJG6B */
/* cleanup temporary buffer */ /* cleanup temporary buffer */
MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax) MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax)
/* cleanup space for JPEG structures */ /* cleanup space for JPEG structures */
#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS) #ifdef MNG_INCLUDE_JNG_READ
MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp)) MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp))
MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source)) MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source))
MNG_FREE (pData, pData->pJPEGderr, sizeof (mngjpeg_error )) MNG_FREE (pData, pData->pJPEGderr, sizeof (mngjpeg_error ))
#endif #endif
#if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS) #ifdef MNG_INCLUDE_JNG_WRITE
MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp )) MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp ))
MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error )) MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error ))
#endif #endif
@ -247,6 +259,7 @@ mng_retcode mngjpeg_cleanup (mng_datap pData)
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressinit (mng_datap pData) mng_retcode mngjpeg_decompressinit (mng_datap pData)
{ {
#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) #if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
@ -299,9 +312,11 @@ mng_retcode mngjpeg_decompressinit (mng_datap pData)
return MNG_NOERROR; return MNG_NOERROR;
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressdata (mng_datap pData, mng_retcode mngjpeg_decompressdata (mng_datap pData,
mng_uint32 iRawsize, mng_uint32 iRawsize,
mng_uint8p pRawdata) mng_uint8p pRawdata)
@ -541,9 +556,11 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
return MNG_NOERROR; return MNG_NOERROR;
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */
#ifdef MNG_INCLUDE_JNG_READ
mng_retcode mngjpeg_decompressfree (mng_datap pData) mng_retcode mngjpeg_decompressfree (mng_datap pData)
{ {
#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) #if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP)
@ -577,6 +594,7 @@ mng_retcode mngjpeg_decompressfree (mng_datap pData)
return MNG_NOERROR; return MNG_NOERROR;
} }
#endif /* MNG_INCLUDE_JNG_READ */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -49,6 +49,11 @@
/* * - optimized some store_xxx routines * */ /* * - optimized some store_xxx routines * */
/* * 0.5.3 - 06/20/2000 - G.Juyn * */ /* * 0.5.3 - 06/20/2000 - G.Juyn * */
/* * - fixed nasty bug with embedded PNG after delta-image * */ /* * - fixed nasty bug with embedded PNG after delta-image * */
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
/* * - fixed problem with 16-bit GA format * */
/* * 0.5.3 - 06/25/2000 - G.Juyn * */
/* * - fixed problem with cheap transparency for 4-bit gray * */
/* * - fixed display_xxxx routines for interlaced images * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -198,7 +203,7 @@ mng_retcode display_rgb8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *pDataline; *pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2); *(pScanline+1) = *(pDataline+2);
@ -210,7 +215,7 @@ mng_retcode display_rgb8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *pDataline; *pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1); *(pScanline+1) = *(pDataline+1);
@ -225,7 +230,7 @@ mng_retcode display_rgb8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iA16 = mng_get_uint16 (pDataline+6); iA16 = mng_get_uint16 (pDataline+6);
@ -266,7 +271,7 @@ mng_retcode display_rgb8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iA8 = *(pDataline+3); /* get alpha value */ iA8 = *(pDataline+3); /* get alpha value */
@ -340,7 +345,7 @@ mng_retcode display_rgba8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *pDataline; *pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2); *(pScanline+1) = *(pDataline+2);
@ -353,7 +358,7 @@ mng_retcode display_rgba8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *pDataline; *pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1); *(pScanline+1) = *(pDataline+1);
@ -369,7 +374,7 @@ mng_retcode display_rgba8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha values */ { /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6); iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+3)); iBGa16 = (mng_uint16)(*(pScanline+3));
@ -442,7 +447,7 @@ mng_retcode display_rgba8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iFGa8 = *(pDataline+3); /* get alpha values */ iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3); iBGa8 = *(pScanline+3);
@ -537,7 +542,7 @@ mng_retcode display_argb8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *(pDataline+6); *pScanline = *(pDataline+6);
*(pScanline+1) = *pDataline; *(pScanline+1) = *pDataline;
@ -550,7 +555,7 @@ mng_retcode display_argb8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *(pDataline+2); *pScanline = *(pDataline+2);
*(pScanline+1) = *pDataline; *(pScanline+1) = *pDataline;
@ -566,7 +571,7 @@ mng_retcode display_argb8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha values */ { /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6); iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pScanline); iBGa16 = (mng_uint16)(*pScanline);
@ -639,7 +644,7 @@ mng_retcode display_argb8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iFGa8 = *(pDataline+3); /* get alpha values */ iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline; iBGa8 = *pScanline;
@ -739,7 +744,7 @@ mng_retcode display_rgb8_a8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *pDataline; *pScanline = *pDataline;
*(pScanline+1) = *(pDataline+2); *(pScanline+1) = *(pDataline+2);
@ -753,7 +758,7 @@ mng_retcode display_rgb8_a8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *pDataline; *pScanline = *pDataline;
*(pScanline+1) = *(pDataline+1); *(pScanline+1) = *(pDataline+1);
@ -770,7 +775,7 @@ mng_retcode display_rgb8_a8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha values */ { /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6); iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pAlphaline); iBGa16 = (mng_uint16)(*pAlphaline);
@ -844,7 +849,7 @@ mng_retcode display_rgb8_a8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iFGa8 = *(pDataline+3); /* get alpha values */ iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3); iBGa8 = *(pScanline+3);
@ -935,7 +940,7 @@ mng_retcode display_bgr8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *(pDataline+4); *pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2); *(pScanline+1) = *(pDataline+2);
@ -947,7 +952,7 @@ mng_retcode display_bgr8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *(pDataline+2); *pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1); *(pScanline+1) = *(pDataline+1);
@ -962,7 +967,7 @@ mng_retcode display_bgr8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha value */ { /* get alpha value */
iA16 = mng_get_uint16 (pDataline+6); iA16 = mng_get_uint16 (pDataline+6);
@ -1003,7 +1008,7 @@ mng_retcode display_bgr8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iA8 = *(pDataline+3); /* get alpha value */ iA8 = *(pDataline+3); /* get alpha value */
@ -1077,7 +1082,7 @@ mng_retcode display_bgra8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *(pDataline+4); *pScanline = *(pDataline+4);
*(pScanline+1) = *(pDataline+2); *(pScanline+1) = *(pDataline+2);
@ -1090,7 +1095,7 @@ mng_retcode display_bgra8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *(pDataline+2); *pScanline = *(pDataline+2);
*(pScanline+1) = *(pDataline+1); *(pScanline+1) = *(pDataline+1);
@ -1106,7 +1111,7 @@ mng_retcode display_bgra8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha values */ { /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6); iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*(pScanline+3)); iBGa16 = (mng_uint16)(*(pScanline+3));
@ -1179,7 +1184,7 @@ mng_retcode display_bgra8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iFGa8 = *(pDataline+3); /* get alpha values */ iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *(pScanline+3); iBGa8 = *(pScanline+3);
@ -1273,7 +1278,7 @@ mng_retcode display_abgr8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* scale down by dropping the LSB */ { /* scale down by dropping the LSB */
*pScanline = *(pDataline+6); *pScanline = *(pDataline+6);
*(pScanline+1) = *(pDataline+4); *(pScanline+1) = *(pDataline+4);
@ -1286,7 +1291,7 @@ mng_retcode display_abgr8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* copy the values */ { /* copy the values */
*pScanline = *(pDataline+3); *pScanline = *(pDataline+3);
*(pScanline+1) = *(pDataline+2); *(pScanline+1) = *(pDataline+2);
@ -1302,7 +1307,7 @@ mng_retcode display_abgr8 (mng_datap pData)
{ {
if (pData->bIsRGBA16) /* 16-bit input row ? */ if (pData->bIsRGBA16) /* 16-bit input row ? */
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ /* get alpha values */ { /* get alpha values */
iFGa16 = mng_get_uint16 (pDataline+6); iFGa16 = mng_get_uint16 (pDataline+6);
iBGa16 = (mng_uint16)(*pScanline); iBGa16 = (mng_uint16)(*pScanline);
@ -1375,7 +1380,7 @@ mng_retcode display_abgr8 (mng_datap pData)
} }
else else
{ {
for (iX = pData->iSourcel; iX < pData->iSourcer; iX += pData->iColinc) for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; iX += pData->iColinc)
{ {
iFGa8 = *(pDataline+3); /* get alpha values */ iFGa8 = *(pDataline+3); /* get alpha values */
iBGa8 = *pScanline; iBGa8 = *pScanline;
@ -4541,7 +4546,6 @@ mng_retcode process_g4 (mng_datap pData)
} }
/* get the gray level */ /* get the gray level */
iQ = (mng_uint8)((iB & iM) >> iS); iQ = (mng_uint8)((iB & iM) >> iS);
iQ = (mng_uint8)(iQ + (iQ << 4));/* expand to 8-bit by replication */
if (iQ == pBuf->iTRNSgray) /* transparent ? */ if (iQ == pBuf->iTRNSgray) /* transparent ? */
{ {
@ -4551,8 +4555,10 @@ mng_retcode process_g4 (mng_datap pData)
*(pRGBArow+3) = 0; *(pRGBArow+3) = 0;
} }
else else
{ { /* expand to 8-bit by replication */
*pRGBArow = iQ; /* put in intermediate row */ iQ = (mng_uint8)(iQ + (iQ << 4));
*pRGBArow = iQ; /* put in intermediate row */
*(pRGBArow+1) = iQ; *(pRGBArow+1) = iQ;
*(pRGBArow+2) = iQ; *(pRGBArow+2) = iQ;
*(pRGBArow+3) = 0xFF; *(pRGBArow+3) = 0xFF;
@ -5321,7 +5327,7 @@ mng_retcode process_ga16 (mng_datap pData)
mng_put_uint16 (pRGBArow+2, iW); mng_put_uint16 (pRGBArow+2, iW);
mng_put_uint16 (pRGBArow+4, iW); mng_put_uint16 (pRGBArow+4, iW);
/* copy the alpha value */ /* copy the alpha value */
mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow+2)); mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2));
pWorkrow += 4; /* next pixel */ pWorkrow += 4; /* next pixel */
pRGBArow += 8; pRGBArow += 8;

View File

@ -35,6 +35,8 @@
/* * 0.5.3 - 06/21/2000 - G.Juyn * */ /* * 0.5.3 - 06/21/2000 - G.Juyn * */
/* * - added get/set for speedtype to facilitate testing * */ /* * - added get/set for speedtype to facilitate testing * */
/* * - added get for imagelevel during processtext callback * */ /* * - added get for imagelevel during processtext callback * */
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
/* * - changed userdata variable to mng_ptr * */
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
@ -58,14 +60,14 @@
/* ************************************************************************** */ /* ************************************************************************** */
mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle,
mng_int32 iUserdata) mng_ptr pUserdata)
{ {
#ifdef MNG_SUPPORT_TRACE #ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_START) MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_START)
#endif #endif
MNG_VALIDHANDLE (hHandle) MNG_VALIDHANDLE (hHandle)
((mng_datap)hHandle)->iUserdata = iUserdata; ((mng_datap)hHandle)->pUserdata = pUserdata;
#ifdef MNG_SUPPORT_TRACE #ifdef MNG_SUPPORT_TRACE
MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_END) MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_END)
@ -817,10 +819,10 @@ mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle,
/* * * */ /* * * */
/* ************************************************************************** */ /* ************************************************************************** */
mng_int32 MNG_DECL mng_get_userdata (mng_handle hHandle) mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle)
{ /* no tracing in here to prevent recursive calls */ { /* no tracing in here to prevent recursive calls */
MNG_VALIDHANDLEX (hHandle) MNG_VALIDHANDLEX (hHandle)
return ((mng_datap)hHandle)->iUserdata; return ((mng_datap)hHandle)->pUserdata;
} }
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -227,7 +227,7 @@ mng_retcode read_chunk (mng_datap pData)
iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj);
/* refresh needed ? */ /* refresh needed ? */
/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh)) /* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh))
iRetcode = display_progressive_refresh (pData, 10); */ iRetcode = display_progressive_refresh (pData, 1); */
/* can we advance to next object ? */ /* can we advance to next object ? */
if ((!iRetcode) && (!pData->bTimerset) && (pData->pCurraniobj)) if ((!iRetcode) && (!pData->bTimerset) && (pData->pCurraniobj))
{ {
@ -387,7 +387,7 @@ mng_retcode read_chunk (mng_datap pData)
/* refresh needed ? */ /* refresh needed ? */
if ((!pData->bTimerset) && (pData->bNeedrefresh)) if ((!pData->bTimerset) && (pData->bNeedrefresh))
{ {
iRetcode = display_progressive_refresh (pData, 10); iRetcode = display_progressive_refresh (pData, 1);
if (iRetcode) /* on error bail out */ if (iRetcode) /* on error bail out */
return iRetcode; return iRetcode;

View File

@ -317,7 +317,7 @@ MNGDecoder::ImgDInit()
/* pass ic as user data */ /* pass ic as user data */
imng_p->handle = imng_p->handle =
mng_initialize((long)ilContainer, il_mng_alloc, il_mng_free, NULL); mng_initialize(ilContainer, il_mng_alloc, il_mng_free, NULL);
//////////// ////////////
// Gamma correction - gross hack, but it's what mozilla's PNG // Gamma correction - gross hack, but it's what mozilla's PNG