From e9cef94eb40aaeb0d85328c1dba5d679ed1f0c04 Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Tue, 30 Jan 2001 01:04:13 +0000 Subject: [PATCH] Bug 66989 - update libmng, flush animation frames, quiet warnings. r=pavlov, sr=brendan --- modules/libimg/mng/CHANGES | 67 +- modules/libimg/mng/README | 12 +- modules/libimg/mng/libmng.h | 23 +- modules/libimg/mng/libmng_chunk_io.c | 41 +- modules/libimg/mng/libmng_chunk_xs.c | 13 +- modules/libimg/mng/libmng_cms.c | 37 +- modules/libimg/mng/libmng_data.h | 34 +- modules/libimg/mng/libmng_display.c | 490 ++++----- modules/libimg/mng/libmng_error.c | 8 +- modules/libimg/mng/libmng_filter.c | 5 - modules/libimg/mng/libmng_object_prc.c | 33 +- modules/libimg/mng/libmng_pixels.c | 1283 ++++++++++++++++++------ modules/libimg/mng/libmng_pixels.h | 61 +- modules/libimg/mng/libmng_read.c | 7 +- modules/libimg/mng/libmng_trace.c | 15 +- modules/libimg/mng/libmng_trace.h | 15 +- modules/libimg/mng/libmng_types.h | 60 +- modules/libimg/mng/libmng_zlib.c | 15 +- modules/libimg/mngcom/nsMNGDecoder.cpp | 7 + 19 files changed, 1573 insertions(+), 653 deletions(-) diff --git a/modules/libimg/mng/CHANGES b/modules/libimg/mng/CHANGES index d5d4962dd050..0c9a28a73c43 100644 --- a/modules/libimg/mng/CHANGES +++ b/modules/libimg/mng/CHANGES @@ -1,26 +1,74 @@ ----------------------------------------------------------- -0.9.4 (xxxx nnth 2000) +0.9.5 (... ..th 2001) ---------------------- in short: -intermediate for now +intermediate ------------------- bugfixes: +B129681 - fixed compiler warnings SGI/Irix (thanks Dimitri) + +core: +- fixed compiler-warnings Mozilla (thanks Tim) +- fixed timing-problem with switching framing_modes +- fixed some small compiler warnings (thanks Nikki) + +samples: + +contrib: + +doc: + +makefiles: + +autoconf: + +----------------------------------------------------------- + +0.9.4 (Jan 19th 2001) +---------------------- + +in short: + +Now that the MNG spec is at 1.0, this should be the last beta. There's a few +small changes to make it inline with the spec, and a couple of bug-fixes. +This is a serious release-candidate for libmng-1.0!! +Please... test test test test!! + +------------------- + +bugfixes: +B123314 - fixed number of TERM related problems +B123322 - fixed unwanted repetition in mng_readdisplay() +B123443 - fixed by Ralph +B124910 - fixed definition for WIN32_LEAN_AND_MEAN (thanks Chad) +B125750 - fixed by Ralph +B125756 - fixed mixup of data- & function-pointers (thanks Dimitri) +B127517 - changed inclusion of the lcms header file for non-windows platforms core: - version numbers - fixed possible loop in display_resume() (Thanks Vova!) - fixed unwanted repetition in mng_readdisplay() - changed inclusion of the lcms header file for non-windows platforms -- changed IHDR filter_method check for PNGs -- moved restore of object 0 to libmng_display -- added restore of object 0 to TERM processing !!! -- fixed TERM delay processing -- fixed TERM end processing (count = 0) +- changed IHDR filter_method check for PNGs +- moved restore of object 0 to libmng_display +- added restore of object 0 to TERM processing (B123314) +- fixed TERM delay processing (B123314) +- fixed TERM end processing when count = 0 (B123314) +- changed callback convention for MSVC (Thanks Chad) +- fixed mixup of data- & function-pointers (thanks Dimitri) +- added support for "nEED MNG-1.0" +- added errorcode for MAGN methods +- added errorchecking for MAGN methods +- removed "old" MAGN methods 3 & 4 +- added "new" MAGN methods 3, 4 & 5 +- removed test filter-methods 1 & 65 +- set default level-set for filtertype=64 to all zeroes samples: @@ -30,6 +78,7 @@ contrib: - updated Jason Summer's mngplg to version 0.9.2 (that's mngplg-0.9.2 based on libmng-0.9.3 !!!) - rearranged contrib directory slightly +- added MSVC project to build libmng.dll by Chad Austin doc: - added README.dll @@ -76,8 +125,8 @@ suggestions and testing this little baby. This would get nowhere without YOU!!! ------------------- bugfixes: -- B111300 - fixup for improved portability -- B117103 - fixed compilation errors on *nix with lcms (thanks Ralph!) +B111300 - fixup for improved portability +B117103 - fixed compilation errors on *nix with lcms (thanks Ralph!) core: - fixed compiler-warnings from Mozilla diff --git a/modules/libimg/mng/README b/modules/libimg/mng/README index 65d4be603a1f..8f04fe37784f 100644 --- a/modules/libimg/mng/README +++ b/modules/libimg/mng/README @@ -1,13 +1,9 @@ -libmng v0.9.3 -------------- +libmng 0.9.4 +------------ -This is the fourth beta-release! +This is the fifth (and last?) beta-release! -Quite a few changes, since there has been several changes in the MNG spec. -Also fixes a number of problems that have surfaced during extensive tests. -And a number of functions have been added to facilitate in integrating -the library in a multitude of applications, as these were the result of -requests from several implementors. +A few small amendments from the spec, and a couple of minor bug-fixes. This is another release candidate. If no significant problems are discovered, libmng 1.0.0 will be just around the corner! diff --git a/modules/libimg/mng/libmng.h b/modules/libimg/mng/libmng.h index 19c22aa49277..9bac28e612ea 100644 --- a/modules/libimg/mng/libmng.h +++ b/modules/libimg/mng/libmng.h @@ -100,7 +100,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng.h copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.5 * */ /* * * */ /* * purpose : main application interface * */ /* * * */ @@ -205,6 +205,10 @@ /* * 0.9.3 - 10/21/2000 - G.Juyn * */ /* * - added get function for interlace/progressive display * */ /* * * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - added errorcode for MAGN methods * */ +/* * - removed test filter-methods 1 & 65 * */ +/* * * */ /* ************************************************************************** */ #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) @@ -343,12 +347,12 @@ extern "C" { /* * * */ /* ************************************************************************** */ -#define MNG_VERSION_TEXT "0.9.4" +#define MNG_VERSION_TEXT "0.9.5" #define MNG_VERSION_SO 0 /* eg. libmng.so.0 (while in test/beta) */ #define MNG_VERSION_DLL 0 /* eg. libmng.dll (nb. same for version 1) */ #define MNG_VERSION_MAJOR 0 #define MNG_VERSION_MINOR 9 -#define MNG_VERSION_RELEASE 4 +#define MNG_VERSION_RELEASE 5 MNG_EXT mng_pchar MNG_DECL mng_version_text (void); MNG_EXT mng_uint8 MNG_DECL mng_version_so (void); @@ -367,10 +371,10 @@ MNG_EXT mng_uint8 MNG_DECL mng_version_release (void); #define MNG_PNG_VERSION_MAJ 1 #define MNG_PNG_VERSION_MIN 2 -#define MNG_MNG_VERSION "0.98a" -#define MNG_MNG_VERSION_MAJ 0 -#define MNG_MNG_VERSION_MIN 98 -#define MNG_MNG_DRAFT 81 +#define MNG_MNG_VERSION "1.0" +#define MNG_MNG_VERSION_MAJ 1 +#define MNG_MNG_VERSION_MIN 0 +#define MNG_MNG_DRAFT 99 /* ************************************************************************** */ /* * * */ @@ -2026,6 +2030,7 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, #define MNG_UNKNOWNCRITICAL (mng_retcode)1061 /* unknown critical chunk found*/ #define MNG_UNSUPPORTEDNEED (mng_retcode)1062 /* nEED requirement unsupported*/ #define MNG_INVALIDDELTA (mng_retcode)1063 /* Delta operation illegal */ +#define MNG_INVALIDMETHOD (mng_retcode)1064 /* invalid MAGN method */ #define MNG_INVALIDCNVSTYLE (mng_retcode)2049 /* can't make anything of this */ #define MNG_WRONGCHUNK (mng_retcode)2050 /* accessing the wrong chunk */ @@ -2184,10 +2189,10 @@ MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, BASI, JHDR */ #define MNG_FILTER_ADAPTIVE 0 /* IHDR, BASI, JHDR */ -#define MNG_FILTER_NO_ADAPTIVE 1 +/* #define MNG_FILTER_NO_ADAPTIVE 1 */ #define MNG_FILTER_NO_DIFFERING 0 #define MNG_FILTER_DIFFERING 0x40 -#define MNG_FILTER_MASK (MNG_FILTER_NO_ADAPTIVE | MNG_FILTER_DIFFERING) +/* #define MNG_FILTER_MASK (MNG_FILTER_NO_ADAPTIVE | MNG_FILTER_DIFFERING) */ #define MNG_INTERLACE_NONE 0 /* IHDR, BASI, JHDR */ #define MNG_INTERLACE_ADAM7 1 diff --git a/modules/libimg/mng/libmng_chunk_io.c b/modules/libimg/mng/libmng_chunk_io.c index e53d5d113dff..a60228158a7f 100644 --- a/modules/libimg/mng/libmng_chunk_io.c +++ b/modules/libimg/mng/libmng_chunk_io.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_chunk_io.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.5 * */ /* * * */ /* * purpose : Chunk I/O routines (implementation) * */ /* * * */ @@ -135,6 +135,12 @@ /* * * */ /* * 0.9.4 - 11/20/2000 - G.Juyn * */ /* * - changed IHDR filter_method check for PNGs * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - added errorchecking for MAGN methods * */ +/* * - removed test filter-methods 1 & 65 * */ +/* * * */ +/* * 0.9.5 - 1/25/2001 - G.Juyn * */ +/* * - fixed some small compiler warnings (thanks Nikki) * */ /* * * */ /* ************************************************************************** */ @@ -600,7 +606,7 @@ READ_CHUNK (read_ihdr) if ((pData->eSigtype == mng_it_png) && (pData->iFilter)) MNG_ERROR (pData, MNG_INVALIDFILTER) else - if (pData->iFilter & (~MNG_FILTER_MASK)) + if (pData->iFilter & (~MNG_FILTER_DIFFERING)) MNG_ERROR (pData, MNG_INVALIDFILTER) if ((pData->iInterlace != MNG_INTERLACE_NONE ) && @@ -3450,7 +3456,7 @@ READ_CHUNK (read_basi) if (pData->iCompression != MNG_COMPRESSION_DEFLATE) MNG_ERROR (pData, MNG_INVALIDCOMPRESS) - if (pData->iFilter != MNG_FILTER_ADAPTIVE) + if (pData->iFilter & (~MNG_FILTER_DIFFERING)) MNG_ERROR (pData, MNG_INVALIDFILTER) if ((pData->iInterlace != MNG_INTERLACE_NONE ) && @@ -4977,6 +4983,14 @@ mng_bool CheckKeyword (mng_datap pData, iDraft = (*(pKeyword+6) - '0') * 10 + (*(pKeyword+7) - '0'); bOke = (mng_bool)(iDraft <= MNG_MNG_DRAFT); } + /* test MNG 1.0 ? */ + if ((!bOke) && (pNull - pKeyword == 7) && + (*pKeyword == 'M') && (*(pKeyword+1) == 'N') && + (*(pKeyword+2) == 'G') && (*(pKeyword+3) == '-') && + (*(pKeyword+4) == '1') && (*(pKeyword+5) == '.') && + (*(pKeyword+6) == '0')) + bOke = MNG_TRUE; + } return bOke; @@ -5184,7 +5198,7 @@ READ_CHUNK (read_jhdr) (pData->iJHDRalphabitdepth != 8 ) ) MNG_ERROR (pData, MNG_INVALIDBITDEPTH) - if (pData->iJHDRalphafilter & (~MNG_FILTER_MASK)) + if (pData->iJHDRalphafilter & (~MNG_FILTER_DIFFERING)) MNG_ERROR (pData, MNG_INVALIDFILTER) if ((pData->iJHDRalphainterlace != MNG_INTERLACE_NONE ) && @@ -6131,6 +6145,9 @@ READ_CHUNK (read_magn) iMethodY = mng_get_uint16 (pRawdata+18); else iMethodY = iMethodX; + /* check field validity */ + if ((iMethodX > 5) || (iMethodY > 5)) + MNG_ERROR (pData, MNG_INVALIDMETHOD) #ifdef MNG_SUPPORT_DISPLAY { @@ -6406,15 +6423,15 @@ WRITE_CHUNK (write_trns) { case 0: { iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pTRNS->iGray; + *pRawdata = (mng_uint8)pTRNS->iGray; break; } case 2: { iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pTRNS->iRed; - *(pRawdata+1) = pTRNS->iGreen; - *(pRawdata+2) = pTRNS->iBlue; + *pRawdata = (mng_uint8)pTRNS->iRed; + *(pRawdata+1) = (mng_uint8)pTRNS->iGreen; + *(pRawdata+2) = (mng_uint8)pTRNS->iBlue; break; } @@ -6864,15 +6881,15 @@ WRITE_CHUNK (write_bkgd) { case 0: { /* gray */ iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pBKGD->iGray; + *pRawdata = (mng_uint8)pBKGD->iGray; break; } case 2: { /* rgb */ iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pBKGD->iRed; - *(pRawdata+1) = pBKGD->iGreen; - *(pRawdata+2) = pBKGD->iBlue; + *pRawdata = (mng_uint8)pBKGD->iRed; + *(pRawdata+1) = (mng_uint8)pBKGD->iGreen; + *(pRawdata+2) = (mng_uint8)pBKGD->iBlue; break; } diff --git a/modules/libimg/mng/libmng_chunk_xs.c b/modules/libimg/mng/libmng_chunk_xs.c index fc192a83242a..9c7315d8bce8 100644 --- a/modules/libimg/mng/libmng_chunk_xs.c +++ b/modules/libimg/mng/libmng_chunk_xs.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_chunk_xs.c copyright (c) 2000 G. Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.5 * */ /* * * */ /* * purpose : chunk access functions (implementation) * */ /* * * */ @@ -49,6 +49,9 @@ /* * 0.9.3 - 10/20/2000 - G.Juyn * */ /* * - fixed putchunk_plte() to set bEmpty parameter * */ /* * * */ +/* * 0.9.5 - 1/25/2001 - G.Juyn * */ +/* * - fixed some small compiler warnings (thanks Nikki) * */ +/* * * */ /* ************************************************************************** */ #include "libmng.h" @@ -4565,10 +4568,10 @@ mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle, /* address proper entry */ pEntry = (mng_pplt_entryp)(((mng_ppltp)pChunk)->aEntries) + iEntry; - pEntry->iRed = iRed; /* fill the entry */ - pEntry->iGreen = iGreen; - pEntry->iBlue = iBlue; - pEntry->iAlpha = iAlpha; + pEntry->iRed = (mng_uint8)iRed; /* fill the entry */ + pEntry->iGreen = (mng_uint8)iGreen; + pEntry->iBlue = (mng_uint8)iBlue; + pEntry->iAlpha = (mng_uint8)iAlpha; pEntry->bUsed = bUsed; #ifdef MNG_SUPPORT_TRACE diff --git a/modules/libimg/mng/libmng_cms.c b/modules/libimg/mng/libmng_cms.c index 75343c7d9a92..ddb521795d26 100644 --- a/modules/libimg/mng/libmng_cms.c +++ b/modules/libimg/mng/libmng_cms.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_cms.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.4 * */ /* * * */ /* * purpose : color management routines (implementation) * */ /* * * */ @@ -42,6 +42,9 @@ /* * 0.9.3 - 08/31/2000 - G.Juyn * */ /* * - fixed sRGB precedence for gamma_only corection * */ /* * * */ +/* * 0.9.4 - 12/16/2000 - G.Juyn * */ +/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ +/* * * */ /* ************************************************************************** */ #include "libmng.h" @@ -169,7 +172,7 @@ mng_retcode init_full_cms (mng_datap pData) if (!hTrans) /* handle error ? */ MNG_ERRORL (pData, MNG_LCMS_NOTRANS) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_full_cms; + pData->fCorrectrow = (mng_fptr)correct_full_cms; return MNG_NOERROR; /* and done */ } @@ -205,7 +208,7 @@ mng_retcode init_full_cms (mng_datap pData) if (!hTrans) /* handle error ? */ MNG_ERRORL (pData, MNG_LCMS_NOTRANS) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_full_cms; + pData->fCorrectrow = (mng_fptr)correct_full_cms; return MNG_NOERROR; /* and done */ } @@ -289,7 +292,7 @@ mng_retcode init_full_cms (mng_datap pData) if (!hTrans) /* handle error ? */ MNG_ERRORL (pData, MNG_LCMS_NOTRANS) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_full_cms; + pData->fCorrectrow = (mng_fptr)correct_full_cms; return MNG_NOERROR; /* and done */ } @@ -345,7 +348,7 @@ mng_retcode init_full_cms_object (mng_datap pData) if (!hTrans) /* handle error ? */ MNG_ERRORL (pData, MNG_LCMS_NOTRANS) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_full_cms; + pData->fCorrectrow = (mng_fptr)correct_full_cms; return MNG_NOERROR; /* and done */ } @@ -374,7 +377,7 @@ mng_retcode init_full_cms_object (mng_datap pData) if (!hTrans) /* handle error ? */ MNG_ERRORL (pData, MNG_LCMS_NOTRANS) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_full_cms; + pData->fCorrectrow = (mng_fptr)correct_full_cms; return MNG_NOERROR; /* and done */ } @@ -441,7 +444,7 @@ mng_retcode init_full_cms_object (mng_datap pData) if (!hTrans) /* handle error ? */ MNG_ERRORL (pData, MNG_LCMS_NOTRANS) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_full_cms; + pData->fCorrectrow = (mng_fptr)correct_full_cms; return MNG_NOERROR; /* and done */ } @@ -520,7 +523,7 @@ mng_retcode init_gamma_only (mng_datap pData) pData->dLastgamma = dGamma; /* keep for next time */ } /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_gamma_only; + pData->fCorrectrow = (mng_fptr)correct_gamma_only; #ifdef MNG_SUPPORT_TRACE MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_END) @@ -567,7 +570,7 @@ mng_retcode init_gamma_only_object (mng_datap pData) pData->dLastgamma = dGamma; /* keep for next time */ } /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_gamma_only; + pData->fCorrectrow = (mng_fptr)correct_gamma_only; #ifdef MNG_SUPPORT_TRACE MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY_OBJ, MNG_LC_END) @@ -660,7 +663,7 @@ mng_retcode init_app_cms (mng_datap pData) if (!pData->fProcessiccp ((mng_handle)pData, iProfilesize, pProfile)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } if ( (pData->fProcesssrgb) && @@ -676,7 +679,7 @@ mng_retcode init_app_cms (mng_datap pData) if (!pData->fProcesssrgb ((mng_handle)pData, iIntent)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } if ( (pData->fProcesschroma) && @@ -716,7 +719,7 @@ mng_retcode init_app_cms (mng_datap pData) iPrimarybluex, iPrimarybluey)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } if ( (pData->fProcessgamma) && @@ -732,7 +735,7 @@ mng_retcode init_app_cms (mng_datap pData) if (!pData->fProcessgamma ((mng_handle)pData, iGamma)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } #ifdef MNG_SUPPORT_TRACE @@ -759,7 +762,7 @@ mng_retcode init_app_cms_object (mng_datap pData) if (!pData->fProcessiccp ((mng_handle)pData, pBuf->iProfilesize, pBuf->pProfile)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } if ((pData->fProcesssrgb) && (pBuf->bHasSRGB)) @@ -767,7 +770,7 @@ mng_retcode init_app_cms_object (mng_datap pData) if (!pData->fProcesssrgb ((mng_handle)pData, pBuf->iRenderingintent)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } if ((pData->fProcesschroma) && (pBuf->bHasCHRM)) @@ -778,7 +781,7 @@ mng_retcode init_app_cms_object (mng_datap pData) pBuf->iPrimarybluex, pBuf->iPrimarybluey)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } if ((pData->fProcessgamma) && (pBuf->bHasGAMA)) @@ -786,7 +789,7 @@ mng_retcode init_app_cms_object (mng_datap pData) if (!pData->fProcessgamma ((mng_handle)pData, pBuf->iGamma)) MNG_ERROR (pData, MNG_APPCMSERROR) /* load color-correction routine */ - pData->fCorrectrow = (mng_ptr)correct_app_cms; + pData->fCorrectrow = (mng_fptr)correct_app_cms; } #ifdef MNG_SUPPORT_TRACE diff --git a/modules/libimg/mng/libmng_data.h b/modules/libimg/mng/libmng_data.h index cef8f6d3606b..80419c934706 100644 --- a/modules/libimg/mng/libmng_data.h +++ b/modules/libimg/mng/libmng_data.h @@ -93,6 +93,8 @@ /* * - fixed support for bKGD * */ /* * 0.9.3 - 10/19/2000 - G.Juyn * */ /* * - implemented delayed delta-processing * */ +/* * 0.9.4 - 12/16/2000 - G.Juyn * */ +/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ /* * * */ /* ************************************************************************** */ @@ -468,27 +470,27 @@ typedef struct mng_data_struct { mng_float dLastgamma; /* last gamma used to compute table */ #endif - mng_ptr fDisplayrow; /* internal callback to display an + mng_fptr fDisplayrow; /* internal callback to display an uncompressed/unfiltered/ color-corrected row */ - mng_ptr fRestbkgdrow; /* internal callback for restore- + mng_fptr fRestbkgdrow; /* internal callback for restore- background processing of a row */ - mng_ptr fCorrectrow; /* internal callback to color-correct an + mng_fptr fCorrectrow; /* internal callback to color-correct an uncompressed/unfiltered row */ - mng_ptr fRetrieverow; /* internal callback to retrieve an + mng_fptr fRetrieverow; /* internal callback to retrieve an uncompressed/unfiltered row of data */ - mng_ptr fStorerow; /* internal callback to store an + mng_fptr fStorerow; /* internal callback to store an uncompressed/unfiltered row of data */ - mng_ptr fProcessrow; /* internal callback to process an + mng_fptr fProcessrow; /* internal callback to process an uncompressed row of data */ - mng_ptr fDifferrow; /* internal callback to perform + mng_fptr fDifferrow; /* internal callback to perform added filter leveling and differing on an unfiltered row */ - mng_ptr fScalerow; /* internal callback to scale a + mng_fptr fScalerow; /* internal callback to scale a delta-row to the bitdepth of its target */ - mng_ptr fDeltarow; /* internal callback to execute a + mng_fptr fDeltarow; /* internal callback to execute a delta-row onto a target */ - mng_ptr fInitrowproc; /* internal callback to initialize + mng_fptr fInitrowproc; /* internal callback to initialize the row processing */ mng_uint16 iDEFIobjectid; /* DEFI fields */ @@ -573,10 +575,10 @@ typedef struct mng_data_struct { mng_uint32 iDeltaBlocky; mng_bool bDeltaimmediate; - mng_ptr fDeltagetrow; /* internal delta-proc callbacks */ - mng_ptr fDeltaaddrow; - mng_ptr fDeltareplacerow; - mng_ptr fDeltaputrow; + mng_fptr fDeltagetrow; /* internal delta-proc callbacks */ + mng_fptr fDeltaaddrow; + mng_fptr fDeltareplacerow; + mng_fptr fDeltaputrow; mng_uint16 iMAGNfromid; mng_uint16 iMAGNtoid; @@ -649,10 +651,10 @@ typedef struct mng_data_struct { mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */ mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */ - mng_ptr fStorerow2; /* internal callback to store an + mng_fptr fStorerow2; /* internal callback to store an uncompressed/unfiltered row of JPEG-data (JDAT) */ - mng_ptr fStorerow3; /* internal callback to store an + mng_fptr fStorerow3; /* internal callback to store an uncompressed/unfiltered row of JPEG-data (JDAA) */ mng_uint32 iJPEGrow; /* row-number for current JPEG row */ diff --git a/modules/libimg/mng/libmng_display.c b/modules/libimg/mng/libmng_display.c index 74176c422dc2..837ce9e5dac6 100644 --- a/modules/libimg/mng/libmng_display.c +++ b/modules/libimg/mng/libmng_display.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_display.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.4 * */ +/* * version : 0.9.5 * */ /* * * */ /* * purpose : Display management (implementation) * */ /* * * */ @@ -123,6 +123,16 @@ /* * - added restore of object 0 to TERM processing !!! * */ /* * - fixed TERM delay processing * */ /* * - fixed TERM end processing (count = 0) * */ +/* * 0.9.4 - 12/16/2000 - G.Juyn * */ +/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - removed test filter-methods 1 & 65 * */ +/* * - set default level-set for filtertype=64 to all zeroes * */ +/* * * */ +/* * 0.9.5 - 1/20/2001 - G.Juyn * */ +/* * - fixed compiler-warnings Mozilla (thanks Tim) * */ +/* * 0.9.5 - 1/23/2001 - G.Juyn * */ +/* * - fixed timing-problem with switching framing_modes * */ /* * * */ /* ************************************************************************** */ @@ -322,32 +332,32 @@ void set_display_routine (mng_datap pData) { switch (pData->iCanvasstyle) /* determine display routine */ { - case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_ptr)display_rgb8; break; } - case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_ptr)display_rgba8; break; } - case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_ptr)display_argb8; break; } - case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_ptr)display_rgb8_a8; break; } - case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_ptr)display_bgr8; break; } - case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_ptr)display_bgra8; break; } - case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_ptr)display_abgr8; break; } -/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_ptr)display_rgb16; break; } */ -/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_ptr)display_rgba16; break; } */ -/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_ptr)display_argb16; break; } */ -/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_ptr)display_bgr16; break; } */ -/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_ptr)display_bgra16; break; } */ -/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_ptr)display_abgr16; break; } */ -/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_ptr)display_index8; break; } */ -/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_ptr)display_indexa8; break; } */ -/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_ptr)display_aindex8; break; } */ -/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_ptr)display_gray8; break; } */ -/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_ptr)display_gray16; break; } */ -/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_ptr)display_graya8; break; } */ -/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_ptr)display_graya16; break; } */ -/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_ptr)display_agray8; break; } */ -/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_ptr)display_agray16; break; } */ -/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_ptr)display_dx15; break; } */ -/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_ptr)display_dx16; break; } */ + case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_fptr)display_rgb8; break; } + case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_fptr)display_rgba8; break; } + case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_fptr)display_argb8; break; } + case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_fptr)display_rgb8_a8; break; } + case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_fptr)display_bgr8; break; } + case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_fptr)display_bgra8; break; } + case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_fptr)display_abgr8; break; } +/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_fptr)display_rgb16; break; } */ +/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_fptr)display_rgba16; break; } */ +/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_fptr)display_argb16; break; } */ +/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_fptr)display_bgr16; break; } */ +/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_fptr)display_bgra16; break; } */ +/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_fptr)display_abgr16; break; } */ +/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_fptr)display_index8; break; } */ +/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_fptr)display_indexa8; break; } */ +/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_fptr)display_aindex8; break; } */ +/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_fptr)display_gray8; break; } */ +/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_fptr)display_gray16; break; } */ +/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_fptr)display_graya8; break; } */ +/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_fptr)display_graya16; break; } */ +/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_fptr)display_agray8; break; } */ +/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_fptr)display_agray16; break; } */ +/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_fptr)display_dx15; break; } */ +/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_fptr)display_dx16; break; } */ } - } + } return; } @@ -381,7 +391,7 @@ mng_retcode load_bkgdlayer (mng_datap pData) mng_int32 iRowsize = pData->iRowsize; mng_bool bIsRGBA16 = pData->bIsRGBA16; mng_bool bIsOpaque = pData->bIsOpaque; - mng_ptr fCorrectrow = pData->fCorrectrow; + mng_fptr fCorrectrow = pData->fCorrectrow; pData->iDestl = 0; /* determine clipping region */ pData->iDestt = 0; @@ -415,7 +425,7 @@ mng_retcode load_bkgdlayer (mng_datap pData) set_display_routine (pData); /* determine display routine */ /* default restore using preset BG color */ - pData->fRestbkgdrow = (mng_ptr)restore_bkgd_bgcolor; + pData->fRestbkgdrow = (mng_fptr)restore_bkgd_bgcolor; if (((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) && (pData->bUseBKGD)) @@ -426,36 +436,36 @@ mng_retcode load_bkgdlayer (mng_datap pData) pImage = (mng_imagep)pData->pObjzero; if (pImage->pImgbuf->bHasBKGD) - pData->fRestbkgdrow = (mng_ptr)restore_bkgd_bkgd; + pData->fRestbkgdrow = (mng_fptr)restore_bkgd_bkgd; } if (pData->fGetbkgdline) /* background-canvas-access callback set ? */ { switch (pData->iBkgdstyle) { - case MNG_CANVAS_RGB8 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_rgb8; break; } - case MNG_CANVAS_BGR8 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_bgr8; break; } - /* case MNG_CANVAS_RGB16 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_rgb16; break; } */ - /* case MNG_CANVAS_BGR16 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_bgr16; break; } */ - /* case MNG_CANVAS_INDEX8 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_index8; break; } */ - /* case MNG_CANVAS_GRAY8 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_gray8; break; } */ - /* case MNG_CANVAS_GRAY16 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_gray16; break; } */ - /* case MNG_CANVAS_DX15 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_dx15; break; } */ - /* case MNG_CANVAS_DX16 : { pData->fRestbkgdrow = (mng_ptr)restore_bkgd_dx16; break; } */ + case MNG_CANVAS_RGB8 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_rgb8; break; } + case MNG_CANVAS_BGR8 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_bgr8; break; } + /* case MNG_CANVAS_RGB16 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_rgb16; break; } */ + /* case MNG_CANVAS_BGR16 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_bgr16; break; } */ + /* case MNG_CANVAS_INDEX8 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_index8; break; } */ + /* case MNG_CANVAS_GRAY8 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_gray8; break; } */ + /* case MNG_CANVAS_GRAY16 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_gray16; break; } */ + /* case MNG_CANVAS_DX15 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_dx15; break; } */ + /* case MNG_CANVAS_DX16 : { pData->fRestbkgdrow = (mng_fptr)restore_bkgd_dx16; break; } */ } } if (pData->bHasBACK) { /* background image ? */ if ((pData->iBACKmandatory & 0x02) && (pData->iBACKimageid)) - pData->fRestbkgdrow = (mng_ptr)restore_bkgd_backimage; + pData->fRestbkgdrow = (mng_fptr)restore_bkgd_backimage; else /* background color ? */ if (pData->iBACKmandatory & 0x01) - pData->fRestbkgdrow = (mng_ptr)restore_bkgd_backcolor; + pData->fRestbkgdrow = (mng_fptr)restore_bkgd_backcolor; } - pData->fCorrectrow = 0; /* default no color-correction */ + pData->fCorrectrow = MNG_NULL; /* default no color-correction */ /* TODO: determine color correction; this is tricky; @@ -613,6 +623,11 @@ mng_retcode next_frame (mng_datap pData, else pData->iFramedelay = pData->iNextdelay; } + else + { + if (iFramemode == 4) /* delay before inserting background layer? */ + iRetcode = interframe_delay (pData); + } if (iRetcode) /* on error bail out */ return iRetcode; @@ -639,8 +654,8 @@ mng_retcode next_frame (mng_datap pData, { /* reload default */ pData->iNextdelay = pData->iFRAMdelay; - if ((iOldmode == 2) || (iOldmode == 4)) - pData->iFramedelay = pData->iNextdelay; +/* if ((iOldmode == 2) || (iOldmode == 4)) + pData->iFramedelay = pData->iNextdelay; */ } if (iChangetimeout) /* timeout changed ? */ @@ -903,34 +918,34 @@ mng_retcode display_image (mng_datap pData, switch (pImage->pImgbuf->iColortype) { case 0 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_g16; + pData->fRetrieverow = (mng_fptr)retrieve_g16; else - pData->fRetrieverow = (mng_ptr)retrieve_g8; + pData->fRetrieverow = (mng_fptr)retrieve_g8; pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); break; } case 2 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_rgb16; + pData->fRetrieverow = (mng_fptr)retrieve_rgb16; else - pData->fRetrieverow = (mng_ptr)retrieve_rgb8; + pData->fRetrieverow = (mng_fptr)retrieve_rgb8; pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); break; } - case 3 : { pData->fRetrieverow = (mng_ptr)retrieve_idx8; + case 3 : { pData->fRetrieverow = (mng_fptr)retrieve_idx8; pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); break; } case 4 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_ga16; + pData->fRetrieverow = (mng_fptr)retrieve_ga16; else - pData->fRetrieverow = (mng_ptr)retrieve_ga8; + pData->fRetrieverow = (mng_fptr)retrieve_ga8; pData->bIsOpaque = MNG_FALSE; break; @@ -938,27 +953,27 @@ mng_retcode display_image (mng_datap pData, case 6 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_rgba16; + pData->fRetrieverow = (mng_fptr)retrieve_rgba16; else - pData->fRetrieverow = (mng_ptr)retrieve_rgba8; + pData->fRetrieverow = (mng_fptr)retrieve_rgba8; pData->bIsOpaque = MNG_FALSE; break; } case 8 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_g16; + pData->fRetrieverow = (mng_fptr)retrieve_g16; else - pData->fRetrieverow = (mng_ptr)retrieve_g8; + pData->fRetrieverow = (mng_fptr)retrieve_g8; pData->bIsOpaque = MNG_TRUE; break; } case 10 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_rgb16; + pData->fRetrieverow = (mng_fptr)retrieve_rgb16; else - pData->fRetrieverow = (mng_ptr)retrieve_rgb8; + pData->fRetrieverow = (mng_fptr)retrieve_rgb8; pData->bIsOpaque = MNG_TRUE; break; @@ -966,9 +981,9 @@ mng_retcode display_image (mng_datap pData, case 12 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_ga16; + pData->fRetrieverow = (mng_fptr)retrieve_ga16; else - pData->fRetrieverow = (mng_ptr)retrieve_ga8; + pData->fRetrieverow = (mng_fptr)retrieve_ga8; pData->bIsOpaque = MNG_FALSE; break; @@ -976,9 +991,9 @@ mng_retcode display_image (mng_datap pData, case 14 : { if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_ptr)retrieve_rgba16; + pData->fRetrieverow = (mng_fptr)retrieve_rgba16; else - pData->fRetrieverow = (mng_ptr)retrieve_rgba8; + pData->fRetrieverow = (mng_fptr)retrieve_rgba8; pData->bIsOpaque = MNG_FALSE; break; @@ -1001,7 +1016,7 @@ mng_retcode display_image (mng_datap pData, pData->iRowsize = pData->iRowsamples << 3; } - pData->fCorrectrow = 0; /* default no color-correction */ + pData->fCorrectrow = MNG_NULL; /* default no color-correction */ #ifdef MNG_NO_CMS iRetcode = MNG_NOERROR; @@ -1196,11 +1211,11 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 1 : { pData->fDeltarow = delta_g1_g1; break; } - case 2 : { pData->fDeltarow = delta_g2_g2; break; } - case 4 : { pData->fDeltarow = delta_g4_g4; break; } - case 8 : { pData->fDeltarow = delta_g8_g8; break; } - case 16 : { pData->fDeltarow = delta_g16_g16; break; } + case 1 : { pData->fDeltarow = (mng_fptr)delta_g1_g1; break; } + case 2 : { pData->fDeltarow = (mng_fptr)delta_g2_g2; break; } + case 4 : { pData->fDeltarow = (mng_fptr)delta_g4_g4; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_g8_g8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_g16_g16; break; } } } } @@ -1218,8 +1233,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_rgb8_rgb8; break; } - case 16 : { pData->fDeltarow = delta_rgb16_rgb16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_rgb8_rgb8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_rgb16_rgb16; break; } } } } @@ -1236,10 +1251,10 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 1 : { pData->fDeltarow = delta_g1_g1; break; } - case 2 : { pData->fDeltarow = delta_g2_g2; break; } - case 4 : { pData->fDeltarow = delta_g4_g4; break; } - case 8 : { pData->fDeltarow = delta_g8_g8; break; } + case 1 : { pData->fDeltarow = (mng_fptr)delta_g1_g1; break; } + case 2 : { pData->fDeltarow = (mng_fptr)delta_g2_g2; break; } + case 4 : { pData->fDeltarow = (mng_fptr)delta_g4_g4; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_g8_g8; break; } } } } @@ -1257,8 +1272,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_ga8_ga8; break; } - case 16 : { pData->fDeltarow = delta_ga16_ga16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_ga8_ga8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_ga16_ga16; break; } } } } @@ -1271,8 +1286,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_ga8_g8; break; } - case 16 : { pData->fDeltarow = delta_ga16_g16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_ga8_g8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_ga16_g16; break; } } } } @@ -1284,8 +1299,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_ga8_a8; break; } - case 16 : { pData->fDeltarow = delta_ga16_a16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_ga8_a8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_ga16_a16; break; } } } } @@ -1303,8 +1318,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_rgba8_rgba8; break; } - case 16 : { pData->fDeltarow = delta_rgba16_rgba16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_rgba8_rgba8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_rgba16_rgba16; break; } } } } @@ -1316,8 +1331,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_rgba8_rgb8; break; } - case 16 : { pData->fDeltarow = delta_rgba16_rgb16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_rgba8_rgb8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_rgba16_rgb16; break; } } } } @@ -1329,8 +1344,8 @@ mng_retcode execute_delta_image (mng_datap pData, { switch (pBuftarget->iBitdepth) { - case 8 : { pData->fDeltarow = delta_rgba8_a8; break; } - case 16 : { pData->fDeltarow = delta_rgba16_a16; break; } + case 8 : { pData->fDeltarow = (mng_fptr)delta_rgba8_a8; break; } + case 16 : { pData->fDeltarow = (mng_fptr)delta_rgba16_a16; break; } } } } @@ -1966,41 +1981,41 @@ mng_retcode process_display_ihdr (mng_datap pData) { case 1 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g1_ni; + pData->fInitrowproc = (mng_fptr)init_g1_ni; else - pData->fInitrowproc = (mng_ptr)init_g1_i; + pData->fInitrowproc = (mng_fptr)init_g1_i; break; } case 2 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g2_ni; + pData->fInitrowproc = (mng_fptr)init_g2_ni; else - pData->fInitrowproc = (mng_ptr)init_g2_i; + pData->fInitrowproc = (mng_fptr)init_g2_i; break; } case 4 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g4_ni; + pData->fInitrowproc = (mng_fptr)init_g4_ni; else - pData->fInitrowproc = (mng_ptr)init_g4_i; + pData->fInitrowproc = (mng_fptr)init_g4_i; break; } case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g8_ni; + pData->fInitrowproc = (mng_fptr)init_g8_ni; else - pData->fInitrowproc = (mng_ptr)init_g8_i; + pData->fInitrowproc = (mng_fptr)init_g8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g16_ni; + pData->fInitrowproc = (mng_fptr)init_g16_ni; else - pData->fInitrowproc = (mng_ptr)init_g16_i; + pData->fInitrowproc = (mng_fptr)init_g16_i; break; } @@ -2013,17 +2028,17 @@ mng_retcode process_display_ihdr (mng_datap pData) { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgb8_ni; + pData->fInitrowproc = (mng_fptr)init_rgb8_ni; else - pData->fInitrowproc = (mng_ptr)init_rgb8_i; + pData->fInitrowproc = (mng_fptr)init_rgb8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgb16_ni; + pData->fInitrowproc = (mng_fptr)init_rgb16_ni; else - pData->fInitrowproc = (mng_ptr)init_rgb16_i; + pData->fInitrowproc = (mng_fptr)init_rgb16_i; break; } @@ -2036,33 +2051,33 @@ mng_retcode process_display_ihdr (mng_datap pData) { case 1 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx1_ni; + pData->fInitrowproc = (mng_fptr)init_idx1_ni; else - pData->fInitrowproc = (mng_ptr)init_idx1_i; + pData->fInitrowproc = (mng_fptr)init_idx1_i; break; } case 2 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx2_ni; + pData->fInitrowproc = (mng_fptr)init_idx2_ni; else - pData->fInitrowproc = (mng_ptr)init_idx2_i; + pData->fInitrowproc = (mng_fptr)init_idx2_i; break; } case 4 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx4_ni; + pData->fInitrowproc = (mng_fptr)init_idx4_ni; else - pData->fInitrowproc = (mng_ptr)init_idx4_i; + pData->fInitrowproc = (mng_fptr)init_idx4_i; break; } case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx8_ni; + pData->fInitrowproc = (mng_fptr)init_idx8_ni; else - pData->fInitrowproc = (mng_ptr)init_idx8_i; + pData->fInitrowproc = (mng_fptr)init_idx8_i; break; } @@ -2075,17 +2090,17 @@ mng_retcode process_display_ihdr (mng_datap pData) { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_ga8_ni; + pData->fInitrowproc = (mng_fptr)init_ga8_ni; else - pData->fInitrowproc = (mng_ptr)init_ga8_i; + pData->fInitrowproc = (mng_fptr)init_ga8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_ga16_ni; + pData->fInitrowproc = (mng_fptr)init_ga16_ni; else - pData->fInitrowproc = (mng_ptr)init_ga16_i; + pData->fInitrowproc = (mng_fptr)init_ga16_i; break; } @@ -2098,17 +2113,17 @@ mng_retcode process_display_ihdr (mng_datap pData) { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgba8_ni; + pData->fInitrowproc = (mng_fptr)init_rgba8_ni; else - pData->fInitrowproc = (mng_ptr)init_rgba8_i; + pData->fInitrowproc = (mng_fptr)init_rgba8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgba16_ni; + pData->fInitrowproc = (mng_fptr)init_rgba16_ni; else - pData->fInitrowproc = (mng_ptr)init_rgba16_i; + pData->fInitrowproc = (mng_fptr)init_rgba16_i; break; } @@ -2119,8 +2134,12 @@ mng_retcode process_display_ihdr (mng_datap pData) } pData->iFilterofs = 0; /* determine filter characteristics */ - - if (pData->iFilter & 0x40) /* leveling & differing ? */ + pData->iLevel0 = 0; /* default levels */ + pData->iLevel1 = 0; + pData->iLevel2 = 0; + pData->iLevel3 = 0; + /* leveling & differing ? */ +/* if (pData->iFilter & 0x40) { switch (pData->iColortype) { @@ -2161,11 +2180,11 @@ mng_retcode process_display_ihdr (mng_datap pData) break; } } - } - - if (pData->iFilter & 0x01) /* no adaptive filtering ? */ + } */ + /* no adaptive filtering ? */ +/* if (pData->iFilter & 0x01) pData->iPixelofs = pData->iFilterofs; - else + else */ pData->iPixelofs = pData->iFilterofs + 1; } @@ -2424,7 +2443,6 @@ mng_retcode process_display_mend (mng_datap pData) /* restart from TERM chunk */ pData->pCurraniobj = pTERM; -/* always refresh, or a zero delay will terminate the animation !!!! */ if (pTERM->iDelay) /* set the delay (?) */ { mng_uint32 iWaitfor = 1000; @@ -2456,12 +2474,10 @@ mng_retcode process_display_mend (mng_datap pData) } iRetcode = display_progressive_refresh (pData, iWaitfor); - } - else - iRetcode = display_progressive_refresh (pData, 1); - if (iRetcode) /* on error bail out */ - return iRetcode; + if (iRetcode) /* on error bail out */ + return iRetcode; + } } else { @@ -2617,10 +2633,10 @@ mng_retcode process_display_basi (mng_datap pData, /* address the object-buffer */ pBuf = pImage->pImgbuf; - pData->fDisplayrow = 0; /* do nothing by default */ - pData->fCorrectrow = 0; - pData->fStorerow = 0; - pData->fProcessrow = 0; + pData->fDisplayrow = MNG_NULL; /* do nothing by default */ + pData->fCorrectrow = MNG_NULL; + pData->fStorerow = MNG_NULL; + pData->fProcessrow = MNG_NULL; /* set parms now that they're known */ iRetcode = reset_object_details (pData, pImage, pData->iDatawidth, pData->iDataheight, pData->iBitdepth, @@ -2789,41 +2805,41 @@ mng_retcode process_display_basi (mng_datap pData, { case 1 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g1_ni; + pData->fInitrowproc = (mng_fptr)init_g1_ni; else - pData->fInitrowproc = (mng_ptr)init_g1_i; + pData->fInitrowproc = (mng_fptr)init_g1_i; break; } case 2 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g2_ni; + pData->fInitrowproc = (mng_fptr)init_g2_ni; else - pData->fInitrowproc = (mng_ptr)init_g2_i; + pData->fInitrowproc = (mng_fptr)init_g2_i; break; } case 4 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g4_ni; + pData->fInitrowproc = (mng_fptr)init_g4_ni; else - pData->fInitrowproc = (mng_ptr)init_g4_i; + pData->fInitrowproc = (mng_fptr)init_g4_i; break; } case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g8_ni; + pData->fInitrowproc = (mng_fptr)init_g8_ni; else - pData->fInitrowproc = (mng_ptr)init_g8_i; + pData->fInitrowproc = (mng_fptr)init_g8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g16_ni; + pData->fInitrowproc = (mng_fptr)init_g16_ni; else - pData->fInitrowproc = (mng_ptr)init_g16_i; + pData->fInitrowproc = (mng_fptr)init_g16_i; break; } @@ -2836,17 +2852,17 @@ mng_retcode process_display_basi (mng_datap pData, { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgb8_ni; + pData->fInitrowproc = (mng_fptr)init_rgb8_ni; else - pData->fInitrowproc = (mng_ptr)init_rgb8_i; + pData->fInitrowproc = (mng_fptr)init_rgb8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgb16_ni; + pData->fInitrowproc = (mng_fptr)init_rgb16_ni; else - pData->fInitrowproc = (mng_ptr)init_rgb16_i; + pData->fInitrowproc = (mng_fptr)init_rgb16_i; break; } @@ -2859,33 +2875,33 @@ mng_retcode process_display_basi (mng_datap pData, { case 1 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx1_ni; + pData->fInitrowproc = (mng_fptr)init_idx1_ni; else - pData->fInitrowproc = (mng_ptr)init_idx1_i; + pData->fInitrowproc = (mng_fptr)init_idx1_i; break; } case 2 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx2_ni; + pData->fInitrowproc = (mng_fptr)init_idx2_ni; else - pData->fInitrowproc = (mng_ptr)init_idx2_i; + pData->fInitrowproc = (mng_fptr)init_idx2_i; break; } case 4 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx4_ni; + pData->fInitrowproc = (mng_fptr)init_idx4_ni; else - pData->fInitrowproc = (mng_ptr)init_idx4_i; + pData->fInitrowproc = (mng_fptr)init_idx4_i; break; } case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx8_ni; + pData->fInitrowproc = (mng_fptr)init_idx8_ni; else - pData->fInitrowproc = (mng_ptr)init_idx8_i; + pData->fInitrowproc = (mng_fptr)init_idx8_i; break; } @@ -2898,17 +2914,17 @@ mng_retcode process_display_basi (mng_datap pData, { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_ga8_ni; + pData->fInitrowproc = (mng_fptr)init_ga8_ni; else - pData->fInitrowproc = (mng_ptr)init_ga8_i; + pData->fInitrowproc = (mng_fptr)init_ga8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_ga16_ni; + pData->fInitrowproc = (mng_fptr)init_ga16_ni; else - pData->fInitrowproc = (mng_ptr)init_ga16_i; + pData->fInitrowproc = (mng_fptr)init_ga16_i; break; } @@ -2921,17 +2937,17 @@ mng_retcode process_display_basi (mng_datap pData, { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgba8_ni; + pData->fInitrowproc = (mng_fptr)init_rgba8_ni; else - pData->fInitrowproc = (mng_ptr)init_rgba8_i; + pData->fInitrowproc = (mng_fptr)init_rgba8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgba16_ni; + pData->fInitrowproc = (mng_fptr)init_rgba16_ni; else - pData->fInitrowproc = (mng_ptr)init_rgba16_i; + pData->fInitrowproc = (mng_fptr)init_rgba16_i; break; } @@ -2942,8 +2958,12 @@ mng_retcode process_display_basi (mng_datap pData, } pData->iFilterofs = 0; /* determine filter characteristics */ - - if (pData->iFilter & 0x40) /* leveling & differing ? */ + pData->iLevel0 = 0; /* default levels */ + pData->iLevel1 = 0; + pData->iLevel2 = 0; + pData->iLevel3 = 0; + /* leveling & differing ? */ +/* if (pData->iFilter & 0x40) { switch (pData->iColortype) { @@ -2984,11 +3004,11 @@ mng_retcode process_display_basi (mng_datap pData, break; } } - } - - if (pData->iFilter & 0x01) /* no adaptive filtering ? */ + } */ + /* no adaptive filtering ? */ +/* if (pData->iFilter & 0x01) pData->iPixelofs = pData->iFilterofs; - else + else */ pData->iPixelofs = pData->iFilterofs + 1; #ifdef MNG_SUPPORT_TRACE @@ -3710,29 +3730,29 @@ mng_retcode process_display_jhdr (mng_datap pData) { case MNG_COLORTYPE_JPEGGRAY : { - pData->fStorerow2 = (mng_ptr)store_jpeg_g8; - pData->fRetrieverow = (mng_ptr)retrieve_g8; + pData->fStorerow2 = (mng_fptr)store_jpeg_g8; + pData->fRetrieverow = (mng_fptr)retrieve_g8; pData->bIsOpaque = MNG_TRUE; break; } case MNG_COLORTYPE_JPEGCOLOR : { - pData->fStorerow2 = (mng_ptr)store_jpeg_rgb8; - pData->fRetrieverow = (mng_ptr)retrieve_rgb8; + pData->fStorerow2 = (mng_fptr)store_jpeg_rgb8; + pData->fRetrieverow = (mng_fptr)retrieve_rgb8; pData->bIsOpaque = MNG_TRUE; break; } case MNG_COLORTYPE_JPEGGRAYA : { - pData->fStorerow2 = (mng_ptr)store_jpeg_ga8; - pData->fRetrieverow = (mng_ptr)retrieve_ga8; + pData->fStorerow2 = (mng_fptr)store_jpeg_ga8; + pData->fRetrieverow = (mng_fptr)retrieve_ga8; pData->bIsOpaque = MNG_FALSE; break; } case MNG_COLORTYPE_JPEGCOLORA : { - pData->fStorerow2 = (mng_ptr)store_jpeg_rgba8; - pData->fRetrieverow = (mng_ptr)retrieve_rgba8; + pData->fStorerow2 = (mng_fptr)store_jpeg_rgba8; + pData->fRetrieverow = (mng_fptr)retrieve_rgba8; pData->bIsOpaque = MNG_FALSE; break; } @@ -3752,12 +3772,12 @@ mng_retcode process_display_jhdr (mng_datap pData) /* determine alpha processing routine */ switch (pData->iJHDRalphabitdepth) { - case 1 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a1_ni; break; } - case 2 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a2_ni; break; } - case 4 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a4_ni; break; } - case 8 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a8_ni; break; } - case 16 : { pData->fInitrowproc = (mng_ptr)init_jpeg_a16_ni; break; } - } + case 1 : { pData->fInitrowproc = (mng_fptr)init_jpeg_a1_ni; break; } + case 2 : { pData->fInitrowproc = (mng_fptr)init_jpeg_a2_ni; break; } + case 4 : { pData->fInitrowproc = (mng_fptr)init_jpeg_a4_ni; break; } + case 8 : { pData->fInitrowproc = (mng_fptr)init_jpeg_a8_ni; break; } + case 16 : { pData->fInitrowproc = (mng_fptr)init_jpeg_a16_ni; break; } + } } else /* possible JDAA alpha-channel ? */ if (pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) @@ -3765,10 +3785,10 @@ mng_retcode process_display_jhdr (mng_datap pData) if (pData->iJHDRimgbitdepth == 8) { if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) - pData->fStorerow3 = (mng_ptr)store_jpeg_g8_alpha; + pData->fStorerow3 = (mng_fptr)store_jpeg_g8_alpha; else if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) - pData->fStorerow3 = (mng_ptr)store_jpeg_rgb8_alpha; + pData->fStorerow3 = (mng_fptr)store_jpeg_rgb8_alpha; } else { @@ -3789,28 +3809,32 @@ mng_retcode process_display_jhdr (mng_datap pData) /* determine alpha processing routine */ switch (pData->iJHDRalphabitdepth) { - case 1 : { pData->fInitrowproc = (mng_ptr)init_g1_ni; break; } - case 2 : { pData->fInitrowproc = (mng_ptr)init_g2_ni; break; } - case 4 : { pData->fInitrowproc = (mng_ptr)init_g4_ni; break; } - case 8 : { pData->fInitrowproc = (mng_ptr)init_g8_ni; break; } - case 16 : { pData->fInitrowproc = (mng_ptr)init_g16_ni; break; } + case 1 : { pData->fInitrowproc = (mng_fptr)init_g1_ni; break; } + case 2 : { pData->fInitrowproc = (mng_fptr)init_g2_ni; break; } + case 4 : { pData->fInitrowproc = (mng_fptr)init_g4_ni; break; } + case 8 : { pData->fInitrowproc = (mng_fptr)init_g8_ni; break; } + case 16 : { pData->fInitrowproc = (mng_fptr)init_g16_ni; break; } } } pData->iFilterofs = 0; /* determine filter characteristics */ + pData->iLevel0 = 0; /* default levels */ + pData->iLevel1 = 0; + pData->iLevel2 = 0; + pData->iLevel3 = 0; /* leveling & differing ? */ - if (pData->iJHDRalphafilter & 0x40) +/* if (pData->iJHDRalphafilter & 0x40) { if (pData->iJHDRalphabitdepth <= 8) pData->iFilterofs = 1; else pData->iFilterofs = 2; - } + } */ /* no adaptive filtering ? */ - if (pData->iJHDRalphafilter & 0x01) +/* if (pData->iJHDRalphafilter & 0x01) pData->iPixelofs = pData->iFilterofs; - else + else */ pData->iPixelofs = pData->iFilterofs + 1; } @@ -3923,17 +3947,17 @@ mng_retcode process_display_dhdr (mng_datap pData, MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START) #endif - pData->fInitrowproc = 0; /* do nothing by default */ - pData->fDisplayrow = 0; - pData->fCorrectrow = 0; - pData->fStorerow = 0; - pData->fProcessrow = 0; - pData->pStoreobj = 0; + pData->fInitrowproc = MNG_NULL; /* do nothing by default */ + pData->fDisplayrow = MNG_NULL; + pData->fCorrectrow = MNG_NULL; + pData->fStorerow = MNG_NULL; + pData->fProcessrow = MNG_NULL; + pData->pStoreobj = MNG_NULL; - pData->fDeltagetrow = 0; - pData->fDeltaaddrow = 0; - pData->fDeltareplacerow = 0; - pData->fDeltaputrow = 0; + pData->fDeltagetrow = MNG_NULL; + pData->fDeltaaddrow = MNG_NULL; + pData->fDeltareplacerow = MNG_NULL; + pData->fDeltaputrow = MNG_NULL; pImage = find_imageobject (pData, iObjectid); @@ -3943,7 +3967,7 @@ mng_retcode process_display_dhdr (mng_datap pData, { /* previous magnification to be done ? */ if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY)) { - mng_retcode iRetcode = magnify_imageobject (pData, pImage); + iRetcode = magnify_imageobject (pData, pImage); if (iRetcode) /* on error bail out */ return iRetcode; @@ -4119,41 +4143,41 @@ mng_retcode process_display_dhdr (mng_datap pData, { case 1 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g1_ni; + pData->fInitrowproc = (mng_fptr)init_g1_ni; else - pData->fInitrowproc = (mng_ptr)init_g1_i; + pData->fInitrowproc = (mng_fptr)init_g1_i; break; } case 2 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g2_ni; + pData->fInitrowproc = (mng_fptr)init_g2_ni; else - pData->fInitrowproc = (mng_ptr)init_g2_i; + pData->fInitrowproc = (mng_fptr)init_g2_i; break; } case 4 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g4_ni; + pData->fInitrowproc = (mng_fptr)init_g4_ni; else - pData->fInitrowproc = (mng_ptr)init_g4_i; + pData->fInitrowproc = (mng_fptr)init_g4_i; break; } case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g8_ni; + pData->fInitrowproc = (mng_fptr)init_g8_ni; else - pData->fInitrowproc = (mng_ptr)init_g8_i; + pData->fInitrowproc = (mng_fptr)init_g8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_g16_ni; + pData->fInitrowproc = (mng_fptr)init_g16_ni; else - pData->fInitrowproc = (mng_ptr)init_g16_i; + pData->fInitrowproc = (mng_fptr)init_g16_i; break; } @@ -4166,17 +4190,17 @@ mng_retcode process_display_dhdr (mng_datap pData, { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgb8_ni; + pData->fInitrowproc = (mng_fptr)init_rgb8_ni; else - pData->fInitrowproc = (mng_ptr)init_rgb8_i; + pData->fInitrowproc = (mng_fptr)init_rgb8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgb16_ni; + pData->fInitrowproc = (mng_fptr)init_rgb16_ni; else - pData->fInitrowproc = (mng_ptr)init_rgb16_i; + pData->fInitrowproc = (mng_fptr)init_rgb16_i; break; } @@ -4189,33 +4213,33 @@ mng_retcode process_display_dhdr (mng_datap pData, { case 1 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx1_ni; + pData->fInitrowproc = (mng_fptr)init_idx1_ni; else - pData->fInitrowproc = (mng_ptr)init_idx1_i; + pData->fInitrowproc = (mng_fptr)init_idx1_i; break; } case 2 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx2_ni; + pData->fInitrowproc = (mng_fptr)init_idx2_ni; else - pData->fInitrowproc = (mng_ptr)init_idx2_i; + pData->fInitrowproc = (mng_fptr)init_idx2_i; break; } case 4 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx4_ni; + pData->fInitrowproc = (mng_fptr)init_idx4_ni; else - pData->fInitrowproc = (mng_ptr)init_idx4_i; + pData->fInitrowproc = (mng_fptr)init_idx4_i; break; } case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_idx8_ni; + pData->fInitrowproc = (mng_fptr)init_idx8_ni; else - pData->fInitrowproc = (mng_ptr)init_idx8_i; + pData->fInitrowproc = (mng_fptr)init_idx8_i; break; } @@ -4228,17 +4252,17 @@ mng_retcode process_display_dhdr (mng_datap pData, { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_ga8_ni; + pData->fInitrowproc = (mng_fptr)init_ga8_ni; else - pData->fInitrowproc = (mng_ptr)init_ga8_i; + pData->fInitrowproc = (mng_fptr)init_ga8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_ga16_ni; + pData->fInitrowproc = (mng_fptr)init_ga16_ni; else - pData->fInitrowproc = (mng_ptr)init_ga16_i; + pData->fInitrowproc = (mng_fptr)init_ga16_i; break; } @@ -4251,17 +4275,17 @@ mng_retcode process_display_dhdr (mng_datap pData, { case 8 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgba8_ni; + pData->fInitrowproc = (mng_fptr)init_rgba8_ni; else - pData->fInitrowproc = (mng_ptr)init_rgba8_i; + pData->fInitrowproc = (mng_fptr)init_rgba8_i; break; } case 16 : { if (!pData->iInterlace) - pData->fInitrowproc = (mng_ptr)init_rgba16_ni; + pData->fInitrowproc = (mng_fptr)init_rgba16_ni; else - pData->fInitrowproc = (mng_ptr)init_rgba16_i; + pData->fInitrowproc = (mng_fptr)init_rgba16_i; break; } @@ -4508,7 +4532,7 @@ mng_retcode process_display_magn (mng_datap pData, { if (iX == 0) /* process object 0 ? */ { - mng_imagep pImage = (mng_imagep)pData->pObjzero; + pImage = (mng_imagep)pData->pObjzero; pImage->iMAGN_MethodX = iMethodX; pImage->iMAGN_MethodY = iMethodY; diff --git a/modules/libimg/mng/libmng_error.c b/modules/libimg/mng/libmng_error.c index 03c65e42b623..fe63d86b35a9 100644 --- a/modules/libimg/mng/libmng_error.c +++ b/modules/libimg/mng/libmng_error.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_error.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.4 * */ /* * * */ /* * purpose : Error routines (implementation) * */ /* * * */ @@ -45,7 +45,10 @@ /* * - fixed processing of unknown critical chunks * */ /* * - added support for nEED * */ /* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added errocode for delayed delta-processing * */ +/* * - added errorcode for delayed delta-processing * */ +/* * * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - added errorcode for MAGN methods * */ /* * * */ /* ************************************************************************** */ @@ -130,6 +133,7 @@ {MNG_UNKNOWNCRITICAL, "Unknown critical chunk encountered"}, {MNG_UNSUPPORTEDNEED, "Requested nEED resources are not supported"}, {MNG_INVALIDDELTA, "The delta operation is invalid (mismatched color_types?)"}, + {MNG_INVALIDMETHOD, "Method is invalid"}, {MNG_INVALIDCNVSTYLE, "Canvas_style is invalid"}, {MNG_WRONGCHUNK, "Attempt to access the wrong chunk"}, diff --git a/modules/libimg/mng/libmng_filter.c b/modules/libimg/mng/libmng_filter.c index c739bed89d05..6f2ea0b8d5a9 100644 --- a/modules/libimg/mng/libmng_filter.c +++ b/modules/libimg/mng/libmng_filter.c @@ -260,11 +260,6 @@ mng_retcode init_rowdiffering (mng_datap pData) MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_START) #endif - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - if (pData->iFilter & 0x40) /* has leveling parameters ? */ { switch (pData->iColortype) /* salvage leveling parameters */ diff --git a/modules/libimg/mng/libmng_object_prc.c b/modules/libimg/mng/libmng_object_prc.c index 31c0a7a8d52c..cd54d58f4d72 100644 --- a/modules/libimg/mng/libmng_object_prc.c +++ b/modules/libimg/mng/libmng_object_prc.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_object_prc.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.5 * */ /* * * */ /* * purpose : Object processing routines (implementation) * */ /* * * */ @@ -70,6 +70,13 @@ /* * 0.9.3 - 10/19/2000 - G.Juyn * */ /* * - added storage for pixel-/alpha-sampledepth for delta's * */ /* * * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - removed "old" MAGN methods 3 & 4 * */ +/* * - added "new" MAGN methods 3, 4 & 5 * */ +/* * * */ +/* * 0.9.5 - 1/22/2001 - G.Juyn * */ +/* * - B129681 - fixed compiler warnings SGI/Irix * */ +/* * * */ /* ************************************************************************** */ #include "libmng.h" @@ -730,7 +737,7 @@ mng_retcode renum_imageobject (mng_datap pData, while ((pPrev) && (pPrev->iId > iId)) pPrev = (mng_imagep)pPrev->sHeader.pPrev; /* different from current ? */ - if (pPrev != pSource->sHeader.pPrev) + if (pPrev != (mng_imagep)pSource->sHeader.pPrev) { if (pSource->sHeader.pPrev) /* unlink from current position !! */ ((mng_imagep)pSource->sHeader.pPrev)->sHeader.pNext = pSource->sHeader.pNext; @@ -1164,16 +1171,18 @@ mng_retcode magnify_imageobject (mng_datap pData, { case 1 : { fMagnifyX = magnify_g8_x1; break; } case 2 : { fMagnifyX = magnify_g8_x2; break; } - case 3 : { fMagnifyX = magnify_g8_x1; break; } + case 3 : { fMagnifyX = magnify_g8_x3; break; } case 4 : { fMagnifyX = magnify_g8_x2; break; } + case 5 : { fMagnifyX = magnify_g8_x3; break; } } switch (pImage->iMAGN_MethodY) { case 1 : { fMagnifyY = magnify_g8_y1; break; } case 2 : { fMagnifyY = magnify_g8_y2; break; } - case 3 : { fMagnifyY = magnify_g8_y1; break; } + case 3 : { fMagnifyY = magnify_g8_y3; break; } case 4 : { fMagnifyY = magnify_g8_y2; break; } + case 5 : { fMagnifyY = magnify_g8_y3; break; } } } else @@ -1194,16 +1203,18 @@ mng_retcode magnify_imageobject (mng_datap pData, { case 1 : { fMagnifyX = magnify_rgb8_x1; break; } case 2 : { fMagnifyX = magnify_rgb8_x2; break; } - case 3 : { fMagnifyX = magnify_rgb8_x1; break; } + case 3 : { fMagnifyX = magnify_rgb8_x3; break; } case 4 : { fMagnifyX = magnify_rgb8_x2; break; } + case 5 : { fMagnifyX = magnify_rgb8_x3; break; } } switch (pImage->iMAGN_MethodY) { case 1 : { fMagnifyY = magnify_rgb8_y1; break; } case 2 : { fMagnifyY = magnify_rgb8_y2; break; } - case 3 : { fMagnifyY = magnify_rgb8_y1; break; } + case 3 : { fMagnifyY = magnify_rgb8_y3; break; } case 4 : { fMagnifyY = magnify_rgb8_y2; break; } + case 5 : { fMagnifyY = magnify_rgb8_y3; break; } } } else @@ -1226,6 +1237,7 @@ mng_retcode magnify_imageobject (mng_datap pData, case 2 : { fMagnifyX = magnify_ga8_x2; break; } case 3 : { fMagnifyX = magnify_ga8_x3; break; } case 4 : { fMagnifyX = magnify_ga8_x4; break; } + case 5 : { fMagnifyX = magnify_ga8_x5; break; } } switch (pImage->iMAGN_MethodY) @@ -1234,6 +1246,7 @@ mng_retcode magnify_imageobject (mng_datap pData, case 2 : { fMagnifyY = magnify_ga8_y2; break; } case 3 : { fMagnifyY = magnify_ga8_y3; break; } case 4 : { fMagnifyY = magnify_ga8_y4; break; } + case 5 : { fMagnifyY = magnify_ga8_y5; break; } } } else @@ -1254,8 +1267,9 @@ mng_retcode magnify_imageobject (mng_datap pData, { case 1 : { fMagnifyX = magnify_rgba8_x1; break; } case 2 : { fMagnifyX = magnify_rgba8_x2; break; } - case 3 : { fMagnifyX = magnify_rgba8_x2; break; } - case 4 : { fMagnifyX = magnify_rgba8_x3; break; } + case 3 : { fMagnifyX = magnify_rgba8_x3; break; } + case 4 : { fMagnifyX = magnify_rgba8_x4; break; } + case 5 : { fMagnifyX = magnify_rgba8_x5; break; } } switch (pImage->iMAGN_MethodY) @@ -1264,6 +1278,7 @@ mng_retcode magnify_imageobject (mng_datap pData, case 2 : { fMagnifyY = magnify_rgba8_y2; break; } case 3 : { fMagnifyY = magnify_rgba8_y3; break; } case 4 : { fMagnifyY = magnify_rgba8_y4; break; } + case 5 : { fMagnifyY = magnify_rgba8_y5; break; } } } else @@ -2343,7 +2358,7 @@ mng_retcode process_ani_endl (mng_datap pData, if (!pLOOP->iRunningcount) /* reached zero ? */ { /* was this the outer LOOP ? */ - if (pLOOP == pData->pFirstaniobj) + if (pData->pFirstaniobj == (mng_objectp)pLOOP) pData->bHasLOOP = MNG_FALSE; } else diff --git a/modules/libimg/mng/libmng_pixels.c b/modules/libimg/mng/libmng_pixels.c index 12046d9500be..fef00641731c 100644 --- a/modules/libimg/mng/libmng_pixels.c +++ b/modules/libimg/mng/libmng_pixels.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_pixels.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.4 * */ /* * * */ /* * purpose : Pixel-row management routines (implementation) * */ /* * * */ @@ -87,6 +87,13 @@ /* * 0.9.3 - 10/28/2000 - G.Juyn * */ /* * - fixed tRNS processing for gray-image < 8-bits * */ /* * * */ +/* * 0.9.4 - 12/16/2000 - G.Juyn * */ +/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - removed "old" MAGN methods 3 & 4 * */ +/* * - added "new" MAGN methods 3, 4 & 5 * */ +/* * - removed test filter-methods 1 & 65 * */ +/* * * */ /* ************************************************************************** */ #include "libmng.h" @@ -6509,18 +6516,18 @@ mng_retcode init_g1_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g1; + pData->fProcessrow = (mng_fptr)process_g1; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g1; + pData->fStorerow = (mng_fptr)delta_g1; else - pData->fStorerow = (mng_ptr)store_g1; + pData->fStorerow = (mng_fptr)store_g1; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g1; + pData->fDifferrow = (mng_fptr)differ_g1; pData->iPass = -1; pData->iRow = 0; @@ -6552,18 +6559,18 @@ mng_retcode init_g1_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g1; + pData->fProcessrow = (mng_fptr)process_g1; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g1; + pData->fStorerow = (mng_fptr)delta_g1; else - pData->fStorerow = (mng_ptr)store_g1; + pData->fStorerow = (mng_fptr)store_g1; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g1; + pData->fDifferrow = (mng_fptr)differ_g1; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -6576,6 +6583,7 @@ mng_retcode init_g1_i (mng_datap pData) pData->iSamplediv = 3; pData->iRowsize = ((pData->iRowsamples + 7) >> 3); pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs; + pData->iFilterbpp = 1; pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ #ifdef MNG_SUPPORT_TRACE @@ -6594,18 +6602,18 @@ mng_retcode init_g2_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g2; + pData->fProcessrow = (mng_fptr)process_g2; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g2; + pData->fStorerow = (mng_fptr)delta_g2; else - pData->fStorerow = (mng_ptr)store_g2; + pData->fStorerow = (mng_fptr)store_g2; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g2; + pData->fDifferrow = (mng_fptr)differ_g2; pData->iPass = -1; pData->iRow = 0; @@ -6637,18 +6645,18 @@ mng_retcode init_g2_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g2; + pData->fProcessrow = (mng_fptr)process_g2; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g2; + pData->fStorerow = (mng_fptr)delta_g2; else - pData->fStorerow = (mng_ptr)store_g2; + pData->fStorerow = (mng_fptr)store_g2; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g2; + pData->fDifferrow = (mng_fptr)differ_g2; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -6680,18 +6688,18 @@ mng_retcode init_g4_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g4; + pData->fProcessrow = (mng_fptr)process_g4; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g4; + pData->fStorerow = (mng_fptr)delta_g4; else - pData->fStorerow = (mng_ptr)store_g4; + pData->fStorerow = (mng_fptr)store_g4; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g4; + pData->fDifferrow = (mng_fptr)differ_g4; pData->iPass = -1; pData->iRow = 0; @@ -6723,18 +6731,18 @@ mng_retcode init_g4_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g4; + pData->fProcessrow = (mng_fptr)process_g4; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g4; + pData->fStorerow = (mng_fptr)delta_g4; else - pData->fStorerow = (mng_ptr)store_g4; + pData->fStorerow = (mng_fptr)store_g4; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g4; + pData->fDifferrow = (mng_fptr)differ_g4; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -6766,18 +6774,18 @@ mng_retcode init_g8_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g8; + pData->fProcessrow = (mng_fptr)process_g8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g8; + pData->fStorerow = (mng_fptr)delta_g8; else - pData->fStorerow = (mng_ptr)store_g8; + pData->fStorerow = (mng_fptr)store_g8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g8; + pData->fDifferrow = (mng_fptr)differ_g8; pData->iPass = -1; pData->iRow = 0; @@ -6809,18 +6817,18 @@ mng_retcode init_g8_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g8; + pData->fProcessrow = (mng_fptr)process_g8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g8; + pData->fStorerow = (mng_fptr)delta_g8; else - pData->fStorerow = (mng_ptr)store_g8; + pData->fStorerow = (mng_fptr)store_g8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g8; + pData->fDifferrow = (mng_fptr)differ_g8; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -6852,18 +6860,18 @@ mng_retcode init_g16_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g16; + pData->fProcessrow = (mng_fptr)process_g16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g16; + pData->fStorerow = (mng_fptr)delta_g16; else - pData->fStorerow = (mng_ptr)store_g16; + pData->fStorerow = (mng_fptr)store_g16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g16; + pData->fDifferrow = (mng_fptr)differ_g16; pData->iPass = -1; pData->iRow = 0; @@ -6895,18 +6903,18 @@ mng_retcode init_g16_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_g16; + pData->fProcessrow = (mng_fptr)process_g16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_g16; + pData->fStorerow = (mng_fptr)delta_g16; else - pData->fStorerow = (mng_ptr)store_g16; + pData->fStorerow = (mng_fptr)store_g16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g16; + pData->fDifferrow = (mng_fptr)differ_g16; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -6938,18 +6946,18 @@ mng_retcode init_rgb8_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgb8; + pData->fProcessrow = (mng_fptr)process_rgb8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgb8; + pData->fStorerow = (mng_fptr)delta_rgb8; else - pData->fStorerow = (mng_ptr)store_rgb8; + pData->fStorerow = (mng_fptr)store_rgb8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgb8; + pData->fDifferrow = (mng_fptr)differ_rgb8; pData->iPass = -1; pData->iRow = 0; @@ -6981,18 +6989,18 @@ mng_retcode init_rgb8_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgb8; + pData->fProcessrow = (mng_fptr)process_rgb8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgb8; + pData->fStorerow = (mng_fptr)delta_rgb8; else - pData->fStorerow = (mng_ptr)store_rgb8; + pData->fStorerow = (mng_fptr)store_rgb8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgb8; + pData->fDifferrow = (mng_fptr)differ_rgb8; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7024,18 +7032,18 @@ mng_retcode init_rgb16_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgb16; + pData->fProcessrow = (mng_fptr)process_rgb16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgb16; + pData->fStorerow = (mng_fptr)delta_rgb16; else - pData->fStorerow = (mng_ptr)store_rgb16; + pData->fStorerow = (mng_fptr)store_rgb16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgb16; + pData->fDifferrow = (mng_fptr)differ_rgb16; pData->iPass = -1; pData->iRow = 0; @@ -7067,18 +7075,18 @@ mng_retcode init_rgb16_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgb16; + pData->fProcessrow = (mng_fptr)process_rgb16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgb16; + pData->fStorerow = (mng_fptr)delta_rgb16; else - pData->fStorerow = (mng_ptr)store_rgb16; + pData->fStorerow = (mng_fptr)store_rgb16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgb16; + pData->fDifferrow = (mng_fptr)differ_rgb16; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7110,18 +7118,18 @@ mng_retcode init_idx1_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx1; + pData->fProcessrow = (mng_fptr)process_idx1; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx1; + pData->fStorerow = (mng_fptr)delta_idx1; else - pData->fStorerow = (mng_ptr)store_idx1; + pData->fStorerow = (mng_fptr)store_idx1; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx1; + pData->fDifferrow = (mng_fptr)differ_idx1; pData->iPass = -1; pData->iRow = 0; @@ -7153,18 +7161,18 @@ mng_retcode init_idx1_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx1; + pData->fProcessrow = (mng_fptr)process_idx1; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx1; + pData->fStorerow = (mng_fptr)delta_idx1; else - pData->fStorerow = (mng_ptr)store_idx1; + pData->fStorerow = (mng_fptr)store_idx1; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx1; + pData->fDifferrow = (mng_fptr)differ_idx1; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7196,18 +7204,18 @@ mng_retcode init_idx2_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx2; + pData->fProcessrow = (mng_fptr)process_idx2; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx2; + pData->fStorerow = (mng_fptr)delta_idx2; else - pData->fStorerow = (mng_ptr)store_idx2; + pData->fStorerow = (mng_fptr)store_idx2; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx2; + pData->fDifferrow = (mng_fptr)differ_idx2; pData->iPass = -1; pData->iRow = 0; @@ -7239,18 +7247,18 @@ mng_retcode init_idx2_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx2; + pData->fProcessrow = (mng_fptr)process_idx2; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx2; + pData->fStorerow = (mng_fptr)delta_idx2; else - pData->fStorerow = (mng_ptr)store_idx2; + pData->fStorerow = (mng_fptr)store_idx2; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx2; + pData->fDifferrow = (mng_fptr)differ_idx2; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7282,18 +7290,18 @@ mng_retcode init_idx4_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx4; + pData->fProcessrow = (mng_fptr)process_idx4; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx4; + pData->fStorerow = (mng_fptr)delta_idx4; else - pData->fStorerow = (mng_ptr)store_idx4; + pData->fStorerow = (mng_fptr)store_idx4; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx4; + pData->fDifferrow = (mng_fptr)differ_idx4; pData->iPass = -1; pData->iRow = 0; @@ -7325,18 +7333,18 @@ mng_retcode init_idx4_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx4; + pData->fProcessrow = (mng_fptr)process_idx4; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx4; + pData->fStorerow = (mng_fptr)delta_idx4; else - pData->fStorerow = (mng_ptr)store_idx4; + pData->fStorerow = (mng_fptr)store_idx4; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx4; + pData->fDifferrow = (mng_fptr)differ_idx4; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7368,18 +7376,18 @@ mng_retcode init_idx8_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx8; + pData->fProcessrow = (mng_fptr)process_idx8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx8; + pData->fStorerow = (mng_fptr)delta_idx8; else - pData->fStorerow = (mng_ptr)store_idx8; + pData->fStorerow = (mng_fptr)store_idx8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx8; + pData->fDifferrow = (mng_fptr)differ_idx8; pData->iPass = -1; pData->iRow = 0; @@ -7411,18 +7419,18 @@ mng_retcode init_idx8_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_idx8; + pData->fProcessrow = (mng_fptr)process_idx8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_idx8; + pData->fStorerow = (mng_fptr)delta_idx8; else - pData->fStorerow = (mng_ptr)store_idx8; + pData->fStorerow = (mng_fptr)store_idx8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_idx8; + pData->fDifferrow = (mng_fptr)differ_idx8; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7454,18 +7462,18 @@ mng_retcode init_ga8_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_ga8; + pData->fProcessrow = (mng_fptr)process_ga8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_ga8; + pData->fStorerow = (mng_fptr)delta_ga8; else - pData->fStorerow = (mng_ptr)store_ga8; + pData->fStorerow = (mng_fptr)store_ga8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_ga8; + pData->fDifferrow = (mng_fptr)differ_ga8; pData->iPass = -1; pData->iRow = 0; @@ -7497,18 +7505,18 @@ mng_retcode init_ga8_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_ga8; + pData->fProcessrow = (mng_fptr)process_ga8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_ga8; + pData->fStorerow = (mng_fptr)delta_ga8; else - pData->fStorerow = (mng_ptr)store_ga8; + pData->fStorerow = (mng_fptr)store_ga8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_ga8; + pData->fDifferrow = (mng_fptr)differ_ga8; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7540,18 +7548,18 @@ mng_retcode init_ga16_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_ga16; + pData->fProcessrow = (mng_fptr)process_ga16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_ga16; + pData->fStorerow = (mng_fptr)delta_ga16; else - pData->fStorerow = (mng_ptr)store_ga16; + pData->fStorerow = (mng_fptr)store_ga16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_ga16; + pData->fDifferrow = (mng_fptr)differ_ga16; pData->iPass = -1; pData->iRow = 0; @@ -7583,18 +7591,18 @@ mng_retcode init_ga16_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_ga16; + pData->fProcessrow = (mng_fptr)process_ga16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_ga16; + pData->fStorerow = (mng_fptr)delta_ga16; else - pData->fStorerow = (mng_ptr)store_ga16; + pData->fStorerow = (mng_fptr)store_ga16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_ga16; + pData->fDifferrow = (mng_fptr)differ_ga16; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7626,18 +7634,18 @@ mng_retcode init_rgba8_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgba8; + pData->fProcessrow = (mng_fptr)process_rgba8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgba8; + pData->fStorerow = (mng_fptr)delta_rgba8; else - pData->fStorerow = (mng_ptr)store_rgba8; + pData->fStorerow = (mng_fptr)store_rgba8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgba8; + pData->fDifferrow = (mng_fptr)differ_rgba8; pData->iPass = -1; pData->iRow = 0; @@ -7669,18 +7677,18 @@ mng_retcode init_rgba8_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgba8; + pData->fProcessrow = (mng_fptr)process_rgba8; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgba8; + pData->fStorerow = (mng_fptr)delta_rgba8; else - pData->fStorerow = (mng_ptr)store_rgba8; + pData->fStorerow = (mng_fptr)store_rgba8; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgba8; + pData->fDifferrow = (mng_fptr)differ_rgba8; pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ pData->iRow = interlace_row [0]; @@ -7712,18 +7720,18 @@ mng_retcode init_rgba16_ni (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgba16; + pData->fProcessrow = (mng_fptr)process_rgba16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgba16; + pData->fStorerow = (mng_fptr)delta_rgba16; else - pData->fStorerow = (mng_ptr)store_rgba16; + pData->fStorerow = (mng_fptr)store_rgba16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgba16; + pData->fDifferrow = (mng_fptr)differ_rgba16; pData->iPass = -1; pData->iRow = 0; @@ -7755,18 +7763,18 @@ mng_retcode init_rgba16_i (mng_datap pData) #endif if (pData->fDisplayrow) - pData->fProcessrow = (mng_ptr)process_rgba16; + pData->fProcessrow = (mng_fptr)process_rgba16; if (pData->pStoreobj) /* store in object too ? */ { /* immediate delta ? */ if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_ptr)delta_rgba16; + pData->fStorerow = (mng_fptr)delta_rgba16; else - pData->fStorerow = (mng_ptr)store_rgba16; + pData->fStorerow = (mng_fptr)store_rgba16; } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_rgba16; + pData->fDifferrow = (mng_fptr)differ_rgba16; pData->iPass = 0; /* from 0..6; (1..7 in specification) */ pData->iRow = interlace_row [0]; @@ -7812,8 +7820,8 @@ mng_retcode init_jpeg_a1_ni (mng_datap pData) { switch (pData->iJHDRcolortype) { - case 12 : { pData->fStorerow = (mng_ptr)store_jpeg_g8_a1; break; } - case 14 : { pData->fStorerow = (mng_ptr)store_jpeg_rgb8_a1; break; } + case 12 : { pData->fStorerow = (mng_fptr)store_jpeg_g8_a1; break; } + case 14 : { pData->fStorerow = (mng_fptr)store_jpeg_rgb8_a1; break; } } } @@ -7822,7 +7830,7 @@ mng_retcode init_jpeg_a1_ni (mng_datap pData) } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g1; + pData->fDifferrow = (mng_fptr)differ_g1; pData->iPass = -1; pData->iRow = 0; @@ -7858,8 +7866,8 @@ mng_retcode init_jpeg_a2_ni (mng_datap pData) { switch (pData->iJHDRcolortype) { - case 12 : { pData->fStorerow = (mng_ptr)store_jpeg_g8_a2; break; } - case 14 : { pData->fStorerow = (mng_ptr)store_jpeg_rgb8_a2; break; } + case 12 : { pData->fStorerow = (mng_fptr)store_jpeg_g8_a2; break; } + case 14 : { pData->fStorerow = (mng_fptr)store_jpeg_rgb8_a2; break; } } } @@ -7868,7 +7876,7 @@ mng_retcode init_jpeg_a2_ni (mng_datap pData) } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g2; + pData->fDifferrow = (mng_fptr)differ_g2; pData->iPass = -1; pData->iRow = 0; @@ -7904,8 +7912,8 @@ mng_retcode init_jpeg_a4_ni (mng_datap pData) { switch (pData->iJHDRcolortype) { - case 12 : { pData->fStorerow = (mng_ptr)store_jpeg_g8_a4; break; } - case 14 : { pData->fStorerow = (mng_ptr)store_jpeg_rgb8_a4; break; } + case 12 : { pData->fStorerow = (mng_fptr)store_jpeg_g8_a4; break; } + case 14 : { pData->fStorerow = (mng_fptr)store_jpeg_rgb8_a4; break; } } } @@ -7914,7 +7922,7 @@ mng_retcode init_jpeg_a4_ni (mng_datap pData) } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g4; + pData->fDifferrow = (mng_fptr)differ_g4; pData->iPass = -1; pData->iRow = 0; @@ -7950,8 +7958,8 @@ mng_retcode init_jpeg_a8_ni (mng_datap pData) { switch (pData->iJHDRcolortype) { - case 12 : { pData->fStorerow = (mng_ptr)store_jpeg_g8_a8; break; } - case 14 : { pData->fStorerow = (mng_ptr)store_jpeg_rgb8_a8; break; } + case 12 : { pData->fStorerow = (mng_fptr)store_jpeg_g8_a8; break; } + case 14 : { pData->fStorerow = (mng_fptr)store_jpeg_rgb8_a8; break; } } } @@ -7960,7 +7968,7 @@ mng_retcode init_jpeg_a8_ni (mng_datap pData) } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g8; + pData->fDifferrow = (mng_fptr)differ_g8; pData->iPass = -1; pData->iRow = 0; @@ -7996,8 +8004,8 @@ mng_retcode init_jpeg_a16_ni (mng_datap pData) { switch (pData->iJHDRcolortype) { - case 12 : { pData->fStorerow = (mng_ptr)store_jpeg_g8_a16; break; } - case 14 : { pData->fStorerow = (mng_ptr)store_jpeg_rgb8_a16; break; } + case 12 : { pData->fStorerow = (mng_fptr)store_jpeg_g8_a16; break; } + case 14 : { pData->fStorerow = (mng_fptr)store_jpeg_rgb8_a16; break; } } } @@ -8006,7 +8014,7 @@ mng_retcode init_jpeg_a16_ni (mng_datap pData) } if (pData->iFilter & 0x40) /* leveling & differing ? */ - pData->fDifferrow = (mng_ptr)differ_g16; + pData->fDifferrow = (mng_fptr)differ_g16; pData->iPass = -1; pData->iRow = 0; @@ -8470,6 +8478,98 @@ mng_retcode magnify_g8_x2 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_g8_x3 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline) +{ + mng_uint32 iX; + mng_int32 iS, iM, iH; + mng_uint8p pTempsrc1; + mng_uint8p pTempsrc2; + mng_uint8p pTempdst; + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_START) +#endif + + pTempsrc1 = pSrcline; /* initialize pixel-loop */ + pTempdst = pDstline; + + for (iX = 0; iX < iWidth; iX++) + { + pTempsrc2 = pTempsrc1 + 1; + + *pTempdst = *pTempsrc1; /* copy original source pixel */ + pTempdst++; + + if (iX == 0) /* first interval ? */ + { + if (iWidth == 1) /* single pixel ? */ + pTempsrc2 = MNG_NULL; + + iM = iML; + } + else + if (iX == (iWidth - 2)) /* last interval ? */ + iM = iMR; + else + iM = iMX; + /* fill interval ? */ + if ((iX < iWidth - 1) || (iWidth == 1)) + { + if (pTempsrc2) /* do we have the second pixel ? */ + { /* is it same as first ? */ + if (*pTempsrc1 == *pTempsrc2) + { + for (iS = 1; iS < iM; iS++) /* then just repeat the first */ + { + *pTempdst = *pTempsrc1; + pTempdst++; + } + } + else + { + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* replicate first half */ + { + *pTempdst = *pTempsrc1; + pTempdst++; + } + + for (iS = iH; iS < iM; iS++) /* replicate second half */ + { + *pTempdst = *pTempsrc2; + pTempdst++; + } + } + } + else + { + for (iS = 1; iS < iM; iS++) + { + *pTempdst = *pTempsrc1; /* repeat first source pixel */ + pTempdst++; + } + } + } + + pTempsrc1++; + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + mng_retcode magnify_rgb8_x1 (mng_datap pData, mng_uint16 iMX, mng_uint16 iML, @@ -8633,6 +8733,101 @@ mng_retcode magnify_rgb8_x2 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_rgb8_x3 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline) +{ + mng_uint32 iX; + mng_int32 iS, iM, iH; + mng_uint8p pTempsrc1; + mng_uint8p pTempsrc2; + mng_uint8p pTempdst; + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_START) +#endif + + pTempsrc1 = pSrcline; /* initialize pixel-loop */ + pTempdst = pDstline; + + for (iX = 0; iX < iWidth; iX++) + { + pTempsrc2 = pTempsrc1 + 3; + + *pTempdst = *pTempsrc1; /* copy original source pixel */ + pTempdst++; + *pTempdst = *(pTempsrc1+1); + pTempdst++; + *pTempdst = *(pTempsrc1+2); + pTempdst++; + + if (iX == 0) /* first interval ? */ + { + if (iWidth == 1) /* single pixel ? */ + pTempsrc2 = MNG_NULL; + + iM = (mng_int32)iML; + } + else + if (iX == (iWidth - 2)) /* last interval ? */ + iM = (mng_int32)iMR; + else + iM = (mng_int32)iMX; + /* fill interval ? */ + if ((iX < iWidth - 1) || (iWidth == 1)) + { + if (pTempsrc2) /* do we have the second pixel ? */ + { + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* replicate first half */ + { + *pTempdst = *pTempsrc1; + *(pTempdst+1) = *(pTempsrc1+1); + *(pTempdst+2) = *(pTempsrc1+2); + + pTempdst += 3; + } + + for (iS = iH; iS < iM; iS++) /* replicate second half */ + { + *pTempdst = *pTempsrc2; + *(pTempdst+1) = *(pTempsrc2+1); + *(pTempdst+2) = *(pTempsrc2+2); + + pTempdst += 3; + } + } + else + { + for (iS = 1; iS < iM; iS++) + { + *pTempdst = *pTempsrc1; /* repeat first source pixel */ + pTempdst++; + *pTempdst = *(pTempsrc1+1); + pTempdst++; + *pTempdst = *(pTempsrc1+2); + pTempdst++; + } + } + } + + pTempsrc1 += 3; + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + mng_retcode magnify_ga8_x1 (mng_datap pData, mng_uint16 iMX, mng_uint16 iML, @@ -8788,7 +8983,7 @@ mng_retcode magnify_ga8_x3 (mng_datap pData, mng_uint8p pDstline) { mng_uint32 iX; - mng_int32 iS, iM; + mng_int32 iS, iM, iH; mng_uint8p pTempsrc1; mng_uint8p pTempsrc2; mng_uint8p pTempdst; @@ -8826,19 +9021,22 @@ mng_retcode magnify_ga8_x3 (mng_datap pData, { if (pTempsrc2) /* do we have the second pixel ? */ { - for (iS = 1; iS < iM; iS++) + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* replicate first half */ { - *pTempdst = *pTempsrc1; /* just repeat the source color */ - pTempdst++; + *pTempdst = *pTempsrc1; + *(pTempdst+1) = *(pTempsrc1+1); - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else /* calculate distance for alpha */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); + pTempdst += 2; + } - pTempdst++; + for (iS = iH; iS < iM; iS++) /* replicate second half */ + { + *pTempdst = *pTempsrc2; + *(pTempdst+1) = *(pTempsrc2+1); + + pTempdst += 2; } } else @@ -8874,7 +9072,7 @@ mng_retcode magnify_ga8_x4 (mng_datap pData, mng_uint8p pDstline) { mng_uint32 iX; - mng_int32 iS, iM; + mng_int32 iS, iM, iH; mng_uint8p pTempsrc1; mng_uint8p pTempsrc2; mng_uint8p pTempdst; @@ -8912,7 +9110,9 @@ mng_retcode magnify_ga8_x4 (mng_datap pData, { if (pTempsrc2) /* do we have the second pixel ? */ { - for (iS = 1; iS < iM; iS++) + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* first half */ { if (*pTempsrc1 == *pTempsrc2) *pTempdst = *pTempsrc1; /* just repeat the first */ @@ -8923,7 +9123,24 @@ mng_retcode magnify_ga8_x4 (mng_datap pData, pTempdst++; - *pTempdst = *(pTempsrc1+1); /* repeat the source alpha */ + *pTempdst = *(pTempsrc1+1); /* replicate alpha from left */ + + pTempdst++; + } + + for (iS = iH; iS < iM; iS++) /* second half */ + { + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; /* just repeat the first */ + else /* calculate the distance */ + *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2)) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + + *pTempdst = *(pTempsrc2+1); /* replicate alpha from right */ + pTempdst++; } } @@ -8951,6 +9168,111 @@ mng_retcode magnify_ga8_x4 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_ga8_x5 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline) +{ + mng_uint32 iX; + mng_int32 iS, iM, iH; + mng_uint8p pTempsrc1; + mng_uint8p pTempsrc2; + mng_uint8p pTempdst; + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_START) +#endif + + pTempsrc1 = pSrcline; /* initialize pixel-loop */ + pTempdst = pDstline; + + for (iX = 0; iX < iWidth; iX++) + { + pTempsrc2 = pTempsrc1 + 2; + + *pTempdst = *pTempsrc1; /* copy original source pixel */ + pTempdst++; + *pTempdst = *(pTempsrc1+1); + pTempdst++; + + if (iX == 0) /* first interval ? */ + { + if (iWidth == 1) /* single pixel ? */ + pTempsrc2 = MNG_NULL; + + iM = iML; + } + else + if (iX == (iWidth - 2)) /* last interval ? */ + iM = iMR; + else + iM = iMX; + /* fill interval ? */ + if ((iX < iWidth - 1) || (iWidth == 1)) + { + if (pTempsrc2) /* do we have the second pixel ? */ + { + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* first half */ + { + *pTempdst = *pTempsrc1; /* replicate gray from left */ + + pTempdst++; + + if (*(pTempsrc1+1) == *(pTempsrc2+1)) + *pTempdst = *(pTempsrc1+1);/* just repeat the first */ + else /* calculate the distance */ + *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - + (mng_int32)(*(pTempsrc1+1)) ) + iM) / + (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); + + pTempdst++; + } + + for (iS = iH; iS < iM; iS++) /* second half */ + { + *pTempdst = *pTempsrc2; /* replicate gray from right */ + + pTempdst++; + + if (*(pTempsrc1+1) == *(pTempsrc2+1)) + *pTempdst = *(pTempsrc1+1);/* just repeat the first */ + else /* calculate the distance */ + *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - + (mng_int32)(*(pTempsrc1+1)) ) + iM) / + (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); + + pTempdst++; + } + } + else + { + for (iS = 1; iS < iM; iS++) + { + *pTempdst = *pTempsrc1; /* repeat first source pixel */ + pTempdst++; + *pTempdst = *(pTempsrc1+1); + pTempdst++; + } + } + } + + pTempsrc1 += 2; + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + mng_retcode magnify_rgba8_x1 (mng_datap pData, mng_uint16 iMX, mng_uint16 iML, @@ -9140,7 +9462,7 @@ mng_retcode magnify_rgba8_x3 (mng_datap pData, mng_uint8p pDstline) { mng_uint32 iX; - mng_int32 iS, iM; + mng_int32 iS, iM, iH; mng_uint8p pTempsrc1; mng_uint8p pTempsrc2; mng_uint8p pTempdst; @@ -9182,23 +9504,26 @@ mng_retcode magnify_rgba8_x3 (mng_datap pData, { if (pTempsrc2) /* do we have the second pixel ? */ { - for (iS = 1; iS < iM; iS++) + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* replicate first half */ { - *pTempdst = *pTempsrc1; /* just repeat the source color */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; + *pTempdst = *pTempsrc1; + *(pTempdst+1) = *(pTempsrc1+1); + *(pTempdst+2) = *(pTempsrc1+2); + *(pTempdst+3) = *(pTempsrc1+3); - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *pTempdst = *(pTempsrc1+3); - else /* calculate the distance for alpha */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); + pTempdst += 4; + } - pTempdst++; + for (iS = iH; iS < iM; iS++) /* replicate second half */ + { + *pTempdst = *pTempsrc2; + *(pTempdst+1) = *(pTempsrc2+1); + *(pTempdst+2) = *(pTempsrc2+2); + *(pTempdst+3) = *(pTempsrc2+3); + + pTempdst += 4; } } else @@ -9238,7 +9563,7 @@ mng_retcode magnify_rgba8_x4 (mng_datap pData, mng_uint8p pDstline) { mng_uint32 iX; - mng_int32 iS, iM; + mng_int32 iS, iM, iH; mng_uint8p pTempsrc1; mng_uint8p pTempsrc2; mng_uint8p pTempdst; @@ -9280,7 +9605,9 @@ mng_retcode magnify_rgba8_x4 (mng_datap pData, { if (pTempsrc2) /* do we have the second pixel ? */ { - for (iS = 1; iS < iM; iS++) + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* first half */ { if (*pTempsrc1 == *pTempsrc2) *pTempdst = *pTempsrc1; /* just repeat the first */ @@ -9308,10 +9635,158 @@ mng_retcode magnify_rgba8_x4 (mng_datap pData, (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); pTempdst++; + /* replicate alpha from left */ + *pTempdst = *(pTempsrc1+3); - *pTempdst = *(pTempsrc1+3); /* repeat the source alpha */ pTempdst++; } + + for (iS = iH; iS < iM; iS++) /* second half */ + { + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; /* just repeat the first */ + else /* calculate the distance */ + *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2)) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + + if (*(pTempsrc1+1) == *(pTempsrc2+1)) + *pTempdst = *(pTempsrc1+1); + else + *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - + (mng_int32)(*(pTempsrc1+1)) ) + iM) / + (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); + + pTempdst++; + + if (*(pTempsrc1+2) == *(pTempsrc2+2)) + *pTempdst = *(pTempsrc1+2); + else + *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - + (mng_int32)(*(pTempsrc1+2)) ) + iM) / + (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); + + pTempdst++; + /* replicate alpha from right */ + *pTempdst = *(pTempsrc2+3); + + pTempdst++; + } + } + else + { + for (iS = 1; iS < iM; iS++) + { + *pTempdst = *pTempsrc1; /* repeat first source pixel */ + pTempdst++; + *pTempdst = *(pTempsrc1+1); + pTempdst++; + *pTempdst = *(pTempsrc1+2); + pTempdst++; + *pTempdst = *(pTempsrc1+3); + pTempdst++; + } + } + } + + pTempsrc1 += 4; + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + +mng_retcode magnify_rgba8_x5 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline) +{ + mng_uint32 iX; + mng_int32 iS, iM, iH; + mng_uint8p pTempsrc1; + mng_uint8p pTempsrc2; + mng_uint8p pTempdst; + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X5, MNG_LC_START) +#endif + + pTempsrc1 = pSrcline; /* initialize pixel-loop */ + pTempdst = pDstline; + + for (iX = 0; iX < iWidth; iX++) + { + pTempsrc2 = pTempsrc1 + 4; + + *pTempdst = *pTempsrc1; /* copy original source pixel */ + pTempdst++; + *pTempdst = *(pTempsrc1+1); + pTempdst++; + *pTempdst = *(pTempsrc1+2); + pTempdst++; + *pTempdst = *(pTempsrc1+3); + pTempdst++; + + if (iX == 0) /* first interval ? */ + { + if (iWidth == 1) /* single pixel ? */ + pTempsrc2 = MNG_NULL; + + iM = (mng_int32)iML; + } + else + if (iX == (iWidth - 2)) /* last interval ? */ + iM = (mng_int32)iMR; + else + iM = (mng_int32)iMX; + /* fill interval ? */ + if ((iX < iWidth - 1) || (iWidth == 1)) + { + if (pTempsrc2) /* do we have the second pixel ? */ + { + iH = (iM+1) / 2; /* calculate halfway point */ + + for (iS = 1; iS < iH; iS++) /* first half */ + { + *pTempdst = *pTempsrc1; /* replicate color from left */ + *(pTempdst+1) = *(pTempsrc1+1); + *(pTempdst+2) = *(pTempsrc1+2); + + if (*(pTempsrc1+3) == *(pTempsrc2+3)) + *(pTempdst+3) = *(pTempsrc1+3); + else + *(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - + (mng_int32)(*(pTempsrc1+3)) ) + iM) / + (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); + + pTempdst += 4; + } + + for (iS = iH; iS < iM; iS++) /* second half */ + { + *pTempdst = *pTempsrc2; /* replicate color from right */ + *(pTempdst+1) = *(pTempsrc2+1); + *(pTempdst+2) = *(pTempsrc2+2); + + if (*(pTempsrc1+3) == *(pTempsrc2+3)) + *(pTempdst+3) = *(pTempsrc1+3); + else + *(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - + (mng_int32)(*(pTempsrc1+3)) ) + iM) / + (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); + + pTempdst += 4; + } } else { @@ -9415,6 +9890,39 @@ mng_retcode magnify_g8_y2 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_g8_y3 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline) +{ +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_START) +#endif + + if (pSrcline2) /* do we have a second line ? */ + { + if (iS < (iM+1) / 2) /* top half ? */ + MNG_COPY (pDstline, pSrcline1, iWidth) + else + MNG_COPY (pDstline, pSrcline2, iWidth) + } + else + { /* just repeat the entire line */ + MNG_COPY (pDstline, pSrcline1, iWidth) + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + mng_retcode magnify_rgb8_y1 (mng_datap pData, mng_int32 iS, mng_int32 iM, @@ -9511,6 +10019,39 @@ mng_retcode magnify_rgb8_y2 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_rgb8_y3 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline) +{ +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_START) +#endif + + if (pSrcline2) /* do we have a second line ? */ + { + if (iS < (iM+1) / 2) /* top half ? */ + MNG_COPY (pDstline, pSrcline1, iWidth * 3) + else + MNG_COPY (pDstline, pSrcline2, iWidth * 3) + } + else + { /* just repeat the entire line */ + MNG_COPY (pDstline, pSrcline1, iWidth * 3) + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + mng_retcode magnify_ga8_y1 (mng_datap pData, mng_int32 iS, mng_int32 iM, @@ -9604,48 +10145,24 @@ mng_retcode magnify_ga8_y3 (mng_datap pData, mng_uint8p pSrcline2, mng_uint8p pDstline) { - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - #ifdef MNG_SUPPORT_TRACE MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y3, MNG_LC_START) #endif - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ + if (pSrcline2) /* do we have a second line ? */ { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* repeat the source color */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else /* calculate the distance for alpha */ - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } + if (iS < (iM+1) / 2) /* top half ? */ + MNG_COPY (pDstline, pSrcline1, iWidth << 1) + else + MNG_COPY (pDstline, pSrcline2, iWidth << 1) } else { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1) + MNG_COPY (pDstline, pSrcline1, iWidth << 1) } #ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y3, MNG_LC_END) + MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END) #endif return MNG_NOERROR; @@ -9676,24 +10193,41 @@ mng_retcode magnify_ga8_y4 (mng_datap pData, if (pTempsrc2) /* do we have a second line ? */ { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + if (iS < (iM+1) / 2) /* top half ? */ + { + for (iX = 0; iX < iWidth; iX++) + { /* calculate the distances */ + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - pTempsrc1++; - pTempsrc2++; + pTempdst++; + pTempsrc1++; + pTempsrc2 += 2; - *pTempdst = *pTempsrc1; /* repeat the source alpha */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; + *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ + } + } + else + { + for (iX = 0; iX < iWidth; iX++) + { /* calculate the distances */ + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1 += 2; + pTempsrc2++; + + *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ + } } } else @@ -9710,6 +10244,88 @@ mng_retcode magnify_ga8_y4 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_ga8_y5 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline) +{ + mng_uint32 iX; + mng_uint8p pTempsrc1; + mng_uint8p pTempsrc2; + mng_uint8p pTempdst; + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_START) +#endif + + pTempsrc1 = pSrcline1; /* initialize pixel-loop */ + pTempsrc2 = pSrcline2; + pTempdst = pDstline; + + if (pTempsrc2) /* do we have a second line ? */ + { + if (iS < (iM+1) / 2) /* top half ? */ + { + for (iX = 0; iX < iWidth; iX++) + { + *pTempdst = *pTempsrc1; /* replicate gray from top */ + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + + if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + } + } + else + { + for (iX = 0; iX < iWidth; iX++) + { + *pTempdst = *pTempsrc2; /* replicate gray from bottom */ + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + + if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + } + } + } + else + { /* just repeat the entire line */ + MNG_COPY (pTempdst, pTempsrc1, iWidth << 1) + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + mng_retcode magnify_rgba8_y1 (mng_datap pData, mng_int32 iS, mng_int32 iM, @@ -9825,60 +10441,24 @@ mng_retcode magnify_rgba8_y3 (mng_datap pData, mng_uint8p pSrcline2, mng_uint8p pDstline) { - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - #ifdef MNG_SUPPORT_TRACE MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y3, MNG_LC_START) #endif - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ + if (pSrcline2) /* do we have a second line ? */ { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* repeat the source color */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - *pTempdst = *pTempsrc1; - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - *pTempdst = *pTempsrc1; - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else /* calculate the distance for alpha */ - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } + if (iS < (iM+1) / 2) /* top half ? */ + MNG_COPY (pDstline, pSrcline1, iWidth << 2) + else + MNG_COPY (pDstline, pSrcline2, iWidth << 2) } else { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2) + MNG_COPY (pDstline, pSrcline1, iWidth << 2) } #ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y3, MNG_LC_END) + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END) #endif return MNG_NOERROR; @@ -9909,46 +10489,85 @@ mng_retcode magnify_rgba8_y4 (mng_datap pData, if (pTempsrc2) /* do we have a second line ? */ { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + if (iS < (iM+1) / 2) /* top half ? */ + { + for (iX = 0; iX < iWidth; iX++) + { /* calculate the distances */ + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - pTempsrc1++; - pTempsrc2++; + pTempdst++; + pTempsrc1++; + pTempsrc2++; - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - pTempsrc1++; - pTempsrc2++; + pTempdst++; + pTempsrc1++; + pTempsrc2++; - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - pTempsrc1++; - pTempsrc2++; + pTempdst++; + pTempsrc1++; + pTempsrc2 += 2; - *pTempdst = *pTempsrc1; /* repeat the source alpha */ + *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ + } + } + else + { + for (iX = 0; iX < iWidth; iX++) + { /* calculate the distances */ + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - pTempsrc1++; - pTempsrc2++; + pTempdst++; + pTempsrc1++; + pTempsrc2++; + + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + + if (*pTempsrc1 == *pTempsrc2) + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1 += 2; + pTempsrc2++; + + *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ + } } } else @@ -9965,6 +10584,88 @@ mng_retcode magnify_rgba8_y4 (mng_datap pData, /* ************************************************************************** */ +mng_retcode magnify_rgba8_y5 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline) +{ + mng_uint32 iX; + mng_uint8p pTempsrc1; + mng_uint8p pTempsrc2; + mng_uint8p pTempdst; + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_START) +#endif + + pTempsrc1 = pSrcline1; /* initialize pixel-loop */ + pTempsrc2 = pSrcline2; + pTempdst = pDstline; + + if (pTempsrc2) /* do we have a second line ? */ + { + if (iS < (iM+1) / 2) /* top half ? */ + { + for (iX = 0; iX < iWidth; iX++) + { + *pTempdst++ = *pTempsrc1++; /* replicate color from top */ + *pTempdst++ = *pTempsrc1++; + *pTempdst++ = *pTempsrc1++; + + pTempsrc2 += 3; + + if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + } + } + else + { + for (iX = 0; iX < iWidth; iX++) + { + *pTempdst++ = *pTempsrc2++; /* replicate color from bottom */ + *pTempdst++ = *pTempsrc2++; + *pTempdst++ = *pTempsrc2++; + + pTempsrc1 += 3; + + if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ + *pTempdst = *pTempsrc1; + else + *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - + (mng_int32)(*pTempsrc1) ) + iM) / + (iM * 2) ) + (mng_int32)(*pTempsrc1) ); + + pTempdst++; + pTempsrc1++; + pTempsrc2++; + } + } + } + else + { /* just repeat the entire line */ + MNG_COPY (pTempdst, pTempsrc1, iWidth << 2) + } + +#ifdef MNG_SUPPORT_TRACE + MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_END) +#endif + + return MNG_NOERROR; +} + +/* ************************************************************************** */ + #endif /* MNG_INCLUDE_DISPLAY_PROCS */ /* ************************************************************************** */ diff --git a/modules/libimg/mng/libmng_pixels.h b/modules/libimg/mng/libmng_pixels.h index 8e533b41a765..4434914de7bb 100644 --- a/modules/libimg/mng/libmng_pixels.h +++ b/modules/libimg/mng/libmng_pixels.h @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_pixels.h copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.4 * */ /* * * */ /* * purpose : Pixel-row management routines (definition) * */ /* * * */ @@ -40,6 +40,9 @@ /* * 0.9.3 - 10/19/2000 - G.Juyn * */ /* * - implemented delayed delta-processing * */ /* * * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - added "new" MAGN methods 3, 4 & 5 * */ +/* * * */ /* ************************************************************************** */ #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) @@ -342,6 +345,13 @@ mng_retcode magnify_g8_x2 (mng_datap pData, mng_uint32 iWidth, mng_uint8p pSrcline, mng_uint8p pDstline); +mng_retcode magnify_g8_x3 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline); mng_retcode magnify_rgb8_x1 (mng_datap pData, mng_uint16 iMX, mng_uint16 iML, @@ -356,6 +366,13 @@ mng_retcode magnify_rgb8_x2 (mng_datap pData, mng_uint32 iWidth, mng_uint8p pSrcline, mng_uint8p pDstline); +mng_retcode magnify_rgb8_x3 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline); mng_retcode magnify_ga8_x1 (mng_datap pData, mng_uint16 iMX, mng_uint16 iML, @@ -384,6 +401,13 @@ mng_retcode magnify_ga8_x4 (mng_datap pData, mng_uint32 iWidth, mng_uint8p pSrcline, mng_uint8p pDstline); +mng_retcode magnify_ga8_x5 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline); mng_retcode magnify_rgba8_x1 (mng_datap pData, mng_uint16 iMX, mng_uint16 iML, @@ -412,6 +436,13 @@ mng_retcode magnify_rgba8_x4 (mng_datap pData, mng_uint32 iWidth, mng_uint8p pSrcline, mng_uint8p pDstline); +mng_retcode magnify_rgba8_x5 (mng_datap pData, + mng_uint16 iMX, + mng_uint16 iML, + mng_uint16 iMR, + mng_uint32 iWidth, + mng_uint8p pSrcline, + mng_uint8p pDstline); mng_retcode magnify_g8_y1 (mng_datap pData, mng_int32 iS, @@ -427,6 +458,13 @@ mng_retcode magnify_g8_y2 (mng_datap pData, mng_uint8p pSrcline1, mng_uint8p pSrcline2, mng_uint8p pDstline); +mng_retcode magnify_g8_y3 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline); mng_retcode magnify_rgb8_y1 (mng_datap pData, mng_int32 iS, mng_int32 iM, @@ -441,6 +479,13 @@ mng_retcode magnify_rgb8_y2 (mng_datap pData, mng_uint8p pSrcline1, mng_uint8p pSrcline2, mng_uint8p pDstline); +mng_retcode magnify_rgb8_y3 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline); mng_retcode magnify_ga8_y1 (mng_datap pData, mng_int32 iS, mng_int32 iM, @@ -469,6 +514,13 @@ mng_retcode magnify_ga8_y4 (mng_datap pData, mng_uint8p pSrcline1, mng_uint8p pSrcline2, mng_uint8p pDstline); +mng_retcode magnify_ga8_y5 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline); mng_retcode magnify_rgba8_y1 (mng_datap pData, mng_int32 iS, mng_int32 iM, @@ -497,6 +549,13 @@ mng_retcode magnify_rgba8_y4 (mng_datap pData, mng_uint8p pSrcline1, mng_uint8p pSrcline2, mng_uint8p pDstline); +mng_retcode magnify_rgba8_y5 (mng_datap pData, + mng_int32 iS, + mng_int32 iM, + mng_uint32 iWidth, + mng_uint8p pSrcline1, + mng_uint8p pSrcline2, + mng_uint8p pDstline); /* ************************************************************************** */ diff --git a/modules/libimg/mng/libmng_read.c b/modules/libimg/mng/libmng_read.c index 298e441f2069..ec1880fe7193 100644 --- a/modules/libimg/mng/libmng_read.c +++ b/modules/libimg/mng/libmng_read.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_read.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.5 * */ /* * * */ /* * purpose : Read logic (implementation) * */ /* * * */ @@ -55,6 +55,9 @@ /* * 0.9.3 - 10/16/2000 - G.Juyn * */ /* * - added support for JDAA * */ /* * * */ +/* * 0.9.5 - 1/23/2001 - G.Juyn * */ +/* * - fixed timing-problem with switching framing_modes * */ +/* * * */ /* ************************************************************************** */ #include "libmng.h" @@ -666,7 +669,7 @@ mng_retcode read_graphic (mng_datap pData) return iRetcode; } #ifdef MNG_SUPPORT_DISPLAY /* until EOF or a break-request */ - while ((!pData->bEOF) && (!pData->bSuspended) && + while (((!pData->bEOF) || (pData->pCurraniobj)) && (!pData->bSuspended) && (!pData->bTimerset) && (!pData->bSectionwait)); #else while ((!pData->bEOF) && (!pData->bSuspended)); diff --git a/modules/libimg/mng/libmng_trace.c b/modules/libimg/mng/libmng_trace.c index 33975f2922bf..914f642dd682 100644 --- a/modules/libimg/mng/libmng_trace.c +++ b/modules/libimg/mng/libmng_trace.c @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_trace.c copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.4 * */ /* * * */ /* * purpose : Trace functions (implementation) * */ /* * * */ @@ -84,6 +84,9 @@ /* * 0.9.3 - 10/21/2000 - G.Juyn * */ /* * - added get function for interlace/progressive display * */ /* * * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - added "new" MAGN methods 3, 4 & 5 * */ +/* * * */ /* ************************************************************************** */ #include "libmng.h" @@ -983,6 +986,8 @@ {MNG_FN_STORE_JPEG_RGBA8, "store_jpeg_rgba8"}, {MNG_FN_STORE_JPEG_GA12, "store_jpeg_ga12"}, {MNG_FN_STORE_JPEG_RGBA12, "store_jpeg_rgba12"}, + {MNG_FN_STORE_JPEG_G8_ALPHA, "store_jpeg_g8_alpha"}, + {MNG_FN_STORE_JPEG_RGB8_ALPHA, "store_jpeg_rgb8_alpha"}, {MNG_FN_INIT_JPEG_A1_NI, "init_jpeg_a1_ni"}, {MNG_FN_INIT_JPEG_A2_NI, "init_jpeg_a2_ni"}, @@ -1030,6 +1035,10 @@ {MNG_FN_MAGNIFY_RGBA8_X2, "magnify_rgba8_x2"}, {MNG_FN_MAGNIFY_RGBA8_X3, "magnify_rgba8_x3"}, {MNG_FN_MAGNIFY_RGBA8_X4, "magnify_rgba8_x4"}, + {MNG_FN_MAGNIFY_G8_X3, "magnify_g8_x3"}, + {MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"}, + {MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"}, + {MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"}, {MNG_FN_MAGNIFY_G8_Y1, "magnify_g8_y1"}, {MNG_FN_MAGNIFY_G8_Y2, "magnify_g8_y2"}, @@ -1043,6 +1052,10 @@ {MNG_FN_MAGNIFY_RGBA8_Y2, "magnify_rgba8_y2"}, {MNG_FN_MAGNIFY_RGBA8_Y3, "magnify_rgba8_y3"}, {MNG_FN_MAGNIFY_RGBA8_Y4, "magnify_rgba8_y4"}, + {MNG_FN_MAGNIFY_G8_Y3, "magnify_g8_y3"}, + {MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"}, + {MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"}, + {MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"}, {MNG_FN_DELTA_G1_G1, "delta_g1_g1"}, {MNG_FN_DELTA_G2_G2, "delta_g2_g2"}, diff --git a/modules/libimg/mng/libmng_trace.h b/modules/libimg/mng/libmng_trace.h index 04a47134a56d..c0c978847c1c 100644 --- a/modules/libimg/mng/libmng_trace.h +++ b/modules/libimg/mng/libmng_trace.h @@ -5,7 +5,7 @@ /* * * */ /* * project : libmng * */ /* * file : libmng_trace.h copyright (c) 2000 G.Juyn * */ -/* * version : 0.9.3 * */ +/* * version : 0.9.4 * */ /* * * */ /* * purpose : Trace functions (definition) * */ /* * * */ @@ -93,6 +93,9 @@ /* * 0.9.3 - 10/21/2000 - G.Juyn * */ /* * - added get function for interlace/progressive display * */ /* * * */ +/* * 0.9.4 - 1/18/2001 - G.Juyn * */ +/* * - added "new" MAGN methods 3, 4 & 5 * */ +/* * * */ /* ************************************************************************** */ #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) @@ -1061,6 +1064,8 @@ mng_retcode mng_trace (mng_datap pData, #define MNG_FN_STORE_JPEG_RGBA8 3506 #define MNG_FN_STORE_JPEG_GA12 3507 #define MNG_FN_STORE_JPEG_RGBA12 3508 +#define MNG_FN_STORE_JPEG_G8_ALPHA 3509 +#define MNG_FN_STORE_JPEG_RGB8_ALPHA 3510 #define MNG_FN_INIT_JPEG_A1_NI 3511 #define MNG_FN_INIT_JPEG_A2_NI 3512 @@ -1110,6 +1115,10 @@ mng_retcode mng_trace (mng_datap pData, #define MNG_FN_MAGNIFY_RGBA8_X2 3710 #define MNG_FN_MAGNIFY_RGBA8_X3 3711 #define MNG_FN_MAGNIFY_RGBA8_X4 3712 +#define MNG_FN_MAGNIFY_G8_X3 3713 +#define MNG_FN_MAGNIFY_RGB8_X3 3714 +#define MNG_FN_MAGNIFY_GA8_X5 3715 +#define MNG_FN_MAGNIFY_RGBA8_X5 3716 #define MNG_FN_MAGNIFY_G8_Y1 3751 #define MNG_FN_MAGNIFY_G8_Y2 3752 @@ -1123,6 +1132,10 @@ mng_retcode mng_trace (mng_datap pData, #define MNG_FN_MAGNIFY_RGBA8_Y2 3760 #define MNG_FN_MAGNIFY_RGBA8_Y3 3761 #define MNG_FN_MAGNIFY_RGBA8_Y4 3762 +#define MNG_FN_MAGNIFY_G8_Y3 3763 +#define MNG_FN_MAGNIFY_RGB8_Y3 3764 +#define MNG_FN_MAGNIFY_GA8_Y5 3765 +#define MNG_FN_MAGNIFY_RGBA8_Y5 3766 /* ************************************************************************** */ diff --git a/modules/libimg/mng/libmng_types.h b/modules/libimg/mng/libmng_types.h index 4055a6d0095b..9a8512a0860d 100644 --- a/modules/libimg/mng/libmng_types.h +++ b/modules/libimg/mng/libmng_types.h @@ -86,6 +86,10 @@ /* * * */ /* * 0.9.4 - 11/20/2000 - R.Giles * */ /* * - fixed inclusion of lcms header for non-windows platforms * */ +/* * 0.9.4 - 12/12/2000 - G.Juyn * */ +/* * - changed callback convention for MSVC (Thanks Chad) * */ +/* * 0.9.4 - 12/16/2000 - G.Juyn * */ +/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ /* * * */ /* ************************************************************************** */ @@ -114,8 +118,11 @@ /* ************************************************************************** */ #ifdef WIN32 /* only include needed stuff */ +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif +#endif + #ifdef MNG_USE_DLL #ifdef MNG_SKIP_ZLIB #undef MNG_INCLUDE_ZLIB @@ -249,6 +256,7 @@ typedef size_t mng_size_t; /* size field for memory alloca typedef char * mng_pchar; /* string */ typedef void * mng_ptr; /* generic pointer */ +typedef void (*mng_fptr) (void); /* generic function pointer */ /* ************************************************************************** */ /* * * */ @@ -366,24 +374,24 @@ typedef enum mng_speedtypes mng_speedtype; /* ************************************************************************** */ /* memory management callbacks */ -typedef mng_ptr MNG_DECL (*mng_memalloc) (mng_size_t iLen); -typedef void MNG_DECL (*mng_memfree) (mng_ptr iPtr, +typedef mng_ptr (MNG_DECL *mng_memalloc) (mng_size_t iLen); +typedef void (MNG_DECL *mng_memfree) (mng_ptr iPtr, mng_size_t iLen); /* I/O management callbacks */ -typedef mng_bool MNG_DECL (*mng_openstream) (mng_handle hHandle); -typedef mng_bool MNG_DECL (*mng_closestream) (mng_handle hHandle); -typedef mng_bool MNG_DECL (*mng_readdata) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_openstream) (mng_handle hHandle); +typedef mng_bool (MNG_DECL *mng_closestream) (mng_handle hHandle); +typedef mng_bool (MNG_DECL *mng_readdata) (mng_handle hHandle, mng_ptr pBuf, mng_uint32 iBuflen, mng_uint32p pRead); -typedef mng_bool MNG_DECL (*mng_writedata) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_writedata) (mng_handle hHandle, mng_ptr pBuf, mng_uint32 iBuflen, mng_uint32p pWritten); /* error & trace processing callbacks */ -typedef mng_bool MNG_DECL (*mng_errorproc) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_errorproc) (mng_handle hHandle, mng_int32 iErrorcode, mng_int8 iSeverity, mng_chunkid iChunkname, @@ -391,53 +399,53 @@ typedef mng_bool MNG_DECL (*mng_errorproc) (mng_handle hHandle, mng_int32 iExtra1, mng_int32 iExtra2, mng_pchar zErrortext); -typedef mng_bool MNG_DECL (*mng_traceproc) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_traceproc) (mng_handle hHandle, mng_int32 iFuncnr, mng_int32 iFuncseq, mng_pchar zFuncname); /* read processing callbacks */ -typedef mng_bool MNG_DECL (*mng_processheader) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processheader) (mng_handle hHandle, mng_uint32 iWidth, mng_uint32 iHeight); -typedef mng_bool MNG_DECL (*mng_processtext) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processtext) (mng_handle hHandle, mng_uint8 iType, mng_pchar zKeyword, mng_pchar zText, mng_pchar zLanguage, mng_pchar zTranslation); -typedef mng_bool MNG_DECL (*mng_processsave) (mng_handle hHandle); -typedef mng_bool MNG_DECL (*mng_processseek) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processsave) (mng_handle hHandle); +typedef mng_bool (MNG_DECL *mng_processseek) (mng_handle hHandle, mng_pchar zName); -typedef mng_bool MNG_DECL (*mng_processneed) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processneed) (mng_handle hHandle, mng_pchar zKeyword); -typedef mng_bool MNG_DECL (*mng_processunknown) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processunknown) (mng_handle hHandle, mng_chunkid iChunkid, mng_uint32 iRawlen, mng_ptr pRawdata); /* display processing callbacks */ -typedef mng_ptr MNG_DECL (*mng_getcanvasline) (mng_handle hHandle, +typedef mng_ptr (MNG_DECL *mng_getcanvasline) (mng_handle hHandle, mng_uint32 iLinenr); -typedef mng_ptr MNG_DECL (*mng_getbkgdline) (mng_handle hHandle, +typedef mng_ptr (MNG_DECL *mng_getbkgdline) (mng_handle hHandle, mng_uint32 iLinenr); -typedef mng_ptr MNG_DECL (*mng_getalphaline) (mng_handle hHandle, +typedef mng_ptr (MNG_DECL *mng_getalphaline) (mng_handle hHandle, mng_uint32 iLinenr); -typedef mng_bool MNG_DECL (*mng_refresh) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_refresh) (mng_handle hHandle, mng_uint32 iX, mng_uint32 iY, mng_uint32 iWidth, mng_uint32 iHeight); /* timer management callbacks */ -typedef mng_uint32 MNG_DECL (*mng_gettickcount) (mng_handle hHandle); -typedef mng_bool MNG_DECL (*mng_settimer) (mng_handle hHandle, +typedef mng_uint32 (MNG_DECL *mng_gettickcount) (mng_handle hHandle); +typedef mng_bool (MNG_DECL *mng_settimer) (mng_handle hHandle, mng_uint32 iMsecs); /* color management callbacks */ -typedef mng_bool MNG_DECL (*mng_processgamma) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processgamma) (mng_handle hHandle, mng_uint32 iGamma); -typedef mng_bool MNG_DECL (*mng_processchroma) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processchroma) (mng_handle hHandle, mng_uint32 iWhitepointx, mng_uint32 iWhitepointy, mng_uint32 iRedx, @@ -446,18 +454,18 @@ typedef mng_bool MNG_DECL (*mng_processchroma) (mng_handle hHandle, mng_uint32 iGreeny, mng_uint32 iBluex, mng_uint32 iBluey); -typedef mng_bool MNG_DECL (*mng_processsrgb) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processsrgb) (mng_handle hHandle, mng_uint8 iRenderingintent); -typedef mng_bool MNG_DECL (*mng_processiccp) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processiccp) (mng_handle hHandle, mng_uint32 iProfilesize, mng_ptr pProfile); -typedef mng_bool MNG_DECL (*mng_processarow) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_processarow) (mng_handle hHandle, mng_uint32 iRowsamples, mng_bool bIsRGBA16, mng_ptr pRow); /* chunk access callback(s) */ -typedef mng_bool MNG_DECL (*mng_iteratechunk) (mng_handle hHandle, +typedef mng_bool (MNG_DECL *mng_iteratechunk) (mng_handle hHandle, mng_handle hChunk, mng_chunkid iChunkid, mng_uint32 iChunkseq); diff --git a/modules/libimg/mng/libmng_zlib.c b/modules/libimg/mng/libmng_zlib.c index 4001609e8d98..18d05f7a75f7 100644 --- a/modules/libimg/mng/libmng_zlib.c +++ b/modules/libimg/mng/libmng_zlib.c @@ -201,15 +201,18 @@ mng_retcode mngzlib_inflaterows (mng_datap pData, if (pData->iRow >= (mng_int32)pData->iDataheight) /* MNG_ERROR (pData, MNG_TOOMUCHIDAT) */ ; /* TODO: check this!!! */ else - { - if (pData->iFilterofs) /* has leveling info ? */ + { /* has leveling info ? */ +/* if (pData->iFilterofs) iRslt = init_rowdiffering (pData); else - iRslt = MNG_NOERROR; + iRslt = MNG_NOERROR; */ /* filter the row if necessary */ - if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) && - (*(pData->pWorkrow + pData->iFilterofs)) ) +/* if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) && + (*(pData->pWorkrow + pData->iFilterofs)) ) */ + if (*(pData->pWorkrow + pData->iFilterofs)) iRslt = filter_a_row (pData); + else + iRslt = MNG_NOERROR; /* additonal leveling/differing ? */ if ((!iRslt) && (pData->fDifferrow)) { @@ -217,7 +220,7 @@ mng_retcode mngzlib_inflaterows (mng_datap pData, pSwap = pData->pWorkrow; pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* so prev points to the processed row! */ + pData->pPrevrow = pSwap; /* make sure we're processing the right data */ } if (!iRslt) diff --git a/modules/libimg/mngcom/nsMNGDecoder.cpp b/modules/libimg/mngcom/nsMNGDecoder.cpp index bdc5d1c0f43b..995ddcad5c37 100644 --- a/modules/libimg/mngcom/nsMNGDecoder.cpp +++ b/modules/libimg/mngcom/nsMNGDecoder.cpp @@ -172,6 +172,11 @@ il_mng_refresh(mng_handle handle, mng_get_refreshpass(handle) /* pass */); } + if (mng_get_imagetype(handle) == mng_it_mng) { + ic->imgdcb->ImgDCBFlushImage(); + ic->imgdcb->ImgDCBHaveImageFrame(); + } + return MNG_TRUE; } @@ -228,6 +233,7 @@ il_mng_free(mng_ptr ptr, mng_size_t size) nsMemory::Free(ptr); } +#ifdef DEBUG_tor static mng_bool il_mng_trace(mng_handle handle, mng_int32 iFuncnr, mng_int32 iFuncseq, mng_pchar zFuncname) @@ -244,6 +250,7 @@ il_mng_error(mng_handle hHandle, mng_int32 iErrorcode, mng_int8 iSeverity, dprintf((stderr, "== error == %s\n", zErrortext)); return MNG_TRUE; } +#endif // Boilerplate methods... *yawn* //===========================================================