2000-06-13 03:06:35 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * For conditions of distribution and use, * */
|
|
|
|
/* * see copyright notice in libmng.h * */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * * */
|
|
|
|
/* * project : libmng * */
|
2000-08-08 07:58:05 +04:00
|
|
|
/* * file : libmng_display.c copyright (c) 2000 G.Juyn * */
|
2001-11-01 03:19:53 +03:00
|
|
|
/* * version : 1.0.2 * */
|
2000-06-13 03:06:35 +04:00
|
|
|
/* * * */
|
|
|
|
/* * purpose : Display management (implementation) * */
|
|
|
|
/* * * */
|
|
|
|
/* * author : G.Juyn * */
|
|
|
|
/* * web : http://www.3-t.com * */
|
|
|
|
/* * email : mailto:info@3-t.com * */
|
|
|
|
/* * * */
|
|
|
|
/* * comment : implementation of the display management routines * */
|
|
|
|
/* * * */
|
|
|
|
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
|
|
|
/* * - changed strict-ANSI stuff * */
|
|
|
|
/* * 0.5.1 - 05/11/2000 - G.Juyn * */
|
|
|
|
/* * - added callback error-reporting support * */
|
|
|
|
/* * - fixed frame_delay misalignment * */
|
|
|
|
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
|
|
|
|
/* * - added sanity check for frozen status * */
|
|
|
|
/* * - changed trace to macro for callback error-reporting * */
|
|
|
|
/* * 0.5.1 - 05/13/2000 - G.Juyn * */
|
|
|
|
/* * - changed display_mend to reset state to initial or SAVE * */
|
|
|
|
/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */
|
|
|
|
/* * - added TERM animation object pointer (easier reference) * */
|
|
|
|
/* * - added process_save & process_seek routines * */
|
|
|
|
/* * 0.5.1 - 05/14/2000 - G.Juyn * */
|
|
|
|
/* * - added save_state and restore_state for SAVE/SEEK/TERM * */
|
|
|
|
/* * processing * */
|
|
|
|
/* * * */
|
|
|
|
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
|
|
|
|
/* * - added JNG support (JHDR/JDAT) * */
|
|
|
|
/* * 0.5.2 - 05/23/2000 - G.Juyn * */
|
|
|
|
/* * - fixed problem with DEFI clipping * */
|
|
|
|
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
|
|
|
|
/* * - added delta-image support (DHDR,PROM,IPNG,IJNG) * */
|
|
|
|
/* * 0.5.2 - 05/31/2000 - G.Juyn * */
|
|
|
|
/* * - fixed pointer confusion (contributed by Tim Rowley) * */
|
|
|
|
/* * 0.5.2 - 06/03/2000 - G.Juyn * */
|
|
|
|
/* * - fixed makeup for Linux gcc compile * */
|
|
|
|
/* * 0.5.2 - 06/05/2000 - G.Juyn * */
|
|
|
|
/* * - added support for RGB8_A8 canvasstyle * */
|
|
|
|
/* * 0.5.2 - 06/09/2000 - G.Juyn * */
|
|
|
|
/* * - fixed timer-handling to run with Mozilla (Tim Rowley) * */
|
|
|
|
/* * 0.5.2 - 06/10/2000 - G.Juyn * */
|
|
|
|
/* * - fixed some compilation-warnings (contrib Jason Morris) * */
|
|
|
|
/* * * */
|
2000-06-14 18:20:55 +04:00
|
|
|
/* * 0.5.3 - 06/12/2000 - G.Juyn * */
|
|
|
|
/* * - fixed display of stored JNG images * */
|
|
|
|
/* * 0.5.3 - 06/13/2000 - G.Juyn * */
|
|
|
|
/* * - fixed problem with BASI-IEND as object 0 * */
|
2000-06-24 02:59:51 +04:00
|
|
|
/* * 0.5.3 - 06/16/2000 - G.Juyn * */
|
|
|
|
/* * - changed progressive-display processing * */
|
|
|
|
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
|
|
|
|
/* * - changed delta-image processing * */
|
|
|
|
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
|
|
|
|
/* * - fixed some minor stuff * */
|
|
|
|
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
|
|
|
|
/* * - added speed-modifier to timing routine * */
|
|
|
|
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
|
|
|
|
/* * - added support for PPLT chunk processing * */
|
2000-06-29 16:32:04 +04:00
|
|
|
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
|
|
|
|
/* * - swapped refresh parameters * */
|
2000-06-14 18:20:55 +04:00
|
|
|
/* * * */
|
2000-07-01 03:41:12 +04:00
|
|
|
/* * 0.9.0 - 06/30/2000 - G.Juyn * */
|
|
|
|
/* * - changed refresh parameters to 'x,y,width,height' * */
|
|
|
|
/* * * */
|
2000-08-08 07:58:05 +04:00
|
|
|
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
|
|
|
|
/* * - implemented support for freeze/reset/resume & go_xxxx * */
|
|
|
|
/* * 0.9.1 - 07/08/2000 - G.Juyn * */
|
|
|
|
/* * - added support for improved timing * */
|
|
|
|
/* * 0.9.1 - 07/14/2000 - G.Juyn * */
|
|
|
|
/* * - changed EOF processing behavior * */
|
|
|
|
/* * - fixed TERM delay processing * */
|
|
|
|
/* * 0.9.1 - 07/15/2000 - G.Juyn * */
|
|
|
|
/* * - fixed freeze & reset processing * */
|
|
|
|
/* * 0.9.1 - 07/16/2000 - G.Juyn * */
|
|
|
|
/* * - fixed storage of images during mng_read() * */
|
|
|
|
/* * - fixed support for mng_display() after mng_read() * */
|
|
|
|
/* * 0.9.1 - 07/24/2000 - G.Juyn * */
|
|
|
|
/* * - fixed reading of still-images * */
|
|
|
|
/* * * */
|
|
|
|
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
|
|
|
/* * - changed file-prefixes * */
|
|
|
|
/* * * */
|
|
|
|
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
|
|
|
|
/* * - B111300 - fixup for improved portability * */
|
2000-11-29 09:45:16 +03:00
|
|
|
/* * 0.9.3 - 08/21/2000 - G.Juyn * */
|
|
|
|
/* * - fixed TERM processing delay of 0 msecs * */
|
|
|
|
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
|
|
|
/* * - added MAGN chunk * */
|
|
|
|
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
|
|
|
|
/* * - fixed problem with no refresh after TERM * */
|
|
|
|
/* * - fixed DEFI behavior * */
|
|
|
|
/* * 0.9.3 - 09/16/2000 - G.Juyn * */
|
|
|
|
/* * - fixed timing & refresh behavior for single PNG/JNG * */
|
|
|
|
/* * 0.9.3 - 09/19/2000 - G.Juyn * */
|
|
|
|
/* * - refixed timing & refresh behavior for single PNG/JNG * */
|
|
|
|
/* * 0.9.3 - 10/02/2000 - G.Juyn * */
|
|
|
|
/* * - fixed timing again (this is getting boring...) * */
|
|
|
|
/* * - refixed problem with no refresh after TERM * */
|
|
|
|
/* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
|
|
|
/* * - added JDAA chunk * */
|
|
|
|
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
|
|
|
|
/* * - fixed support for bKGD * */
|
|
|
|
/* * 0.9.3 - 10/18/2000 - G.Juyn * */
|
|
|
|
/* * - fixed delta-processing behavior * */
|
|
|
|
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
|
|
|
|
/* * - added storage for pixel-/alpha-sampledepth for delta's * */
|
|
|
|
/* * 0.9.3 - 10/27/2000 - G.Juyn * */
|
|
|
|
/* * - fixed seperate read() & display() processing * */
|
|
|
|
/* * * */
|
|
|
|
/* * 0.9.4 - 10/31/2000 - G.Juyn * */
|
|
|
|
/* * - fixed possible loop in display_resume() (Thanks Vova!) * */
|
|
|
|
/* * 0.9.4 - 11/20/2000 - G.Juyn * */
|
|
|
|
/* * - fixed unwanted repetition in mng_readdisplay() * */
|
|
|
|
/* * 0.9.4 - 11/24/2000 - G.Juyn * */
|
|
|
|
/* * - 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) * */
|
2001-01-30 04:04:13 +03:00
|
|
|
/* * 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 * */
|
2000-08-08 07:58:05 +04:00
|
|
|
/* * * */
|
2001-05-20 21:36:25 +04:00
|
|
|
/* * 1.0.1 - 02/08/2001 - G.Juyn * */
|
|
|
|
/* * - added MEND processing callback * */
|
|
|
|
/* * 1.0.1 - 02/13/2001 - G.Juyn * */
|
|
|
|
/* * - fixed first FRAM_MODE=4 timing problem * */
|
|
|
|
/* * 1.0.1 - 04/21/2001 - G.Juyn * */
|
|
|
|
/* * - fixed memory-leak for JNGs with alpha (Thanks Gregg!) * */
|
|
|
|
/* * - added BGRA8 canvas with premultiplied alpha * */
|
|
|
|
/* * * */
|
2001-11-01 03:19:53 +03:00
|
|
|
/* * 1.0.2 - 06/25/2001 - G.Juyn * */
|
|
|
|
/* * - fixed memory-leak with delta-images (Thanks Michael!) * */
|
|
|
|
/* * * */
|
2000-06-13 03:06:35 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "libmng.h"
|
2000-08-08 07:58:05 +04:00
|
|
|
#include "libmng_data.h"
|
|
|
|
#include "libmng_error.h"
|
|
|
|
#include "libmng_trace.h"
|
2000-06-13 03:06:35 +04:00
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
2000-08-08 07:58:05 +04:00
|
|
|
#include "libmng_objects.h"
|
|
|
|
#include "libmng_object_prc.h"
|
|
|
|
#include "libmng_memory.h"
|
|
|
|
#include "libmng_zlib.h"
|
|
|
|
#include "libmng_jpeg.h"
|
|
|
|
#include "libmng_cms.h"
|
|
|
|
#include "libmng_pixels.h"
|
|
|
|
#include "libmng_display.h"
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
|
|
|
#pragma option -A /* force ANSI-C */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#ifdef MNG_INCLUDE_DISPLAY_PROCS
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode set_delay (mng_datap pData,
|
|
|
|
mng_uint32 iInterval)
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!iInterval) /* at least 1 msec please! */
|
|
|
|
iInterval = 1;
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
if (!pData->fSettimer ((mng_handle)pData, iInterval))
|
|
|
|
MNG_ERROR (pData, MNG_APPTIMERERROR)
|
|
|
|
|
|
|
|
pData->bTimerset = MNG_TRUE; /* and indicate so */
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * * */
|
2000-08-08 07:58:05 +04:00
|
|
|
/* * Progressive display refresh - does the call to the refresh callback * */
|
|
|
|
/* * and sets the timer to allow the app to perform the actual refresh to * */
|
|
|
|
/* * the screen (eg. process its main message-loop) * */
|
2000-06-24 02:59:51 +04:00
|
|
|
/* * * */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode display_progressive_refresh (mng_datap pData,
|
|
|
|
mng_uint32 iInterval)
|
2000-08-08 07:58:05 +04:00
|
|
|
{
|
|
|
|
if (!pData->bSearching) /* we mustn't be searching !!! */
|
2000-11-29 09:45:16 +03:00
|
|
|
{
|
|
|
|
if ((pData->bRunning) && /* let the app refresh first ? */
|
|
|
|
(pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright))
|
2000-08-08 07:58:05 +04:00
|
|
|
{
|
|
|
|
if (!pData->fRefresh (((mng_handle)pData),
|
|
|
|
pData->iUpdateleft, pData->iUpdatetop,
|
|
|
|
pData->iUpdateright - pData->iUpdateleft,
|
|
|
|
pData->iUpdatebottom - pData->iUpdatetop))
|
|
|
|
MNG_ERROR (pData, MNG_APPMISCERROR)
|
|
|
|
|
|
|
|
pData->iUpdateleft = 0; /* reset update-region */
|
|
|
|
pData->iUpdateright = 0;
|
|
|
|
pData->iUpdatetop = 0;
|
|
|
|
pData->iUpdatebottom = 0; /* reset refreshneeded indicator */
|
|
|
|
pData->bNeedrefresh = MNG_FALSE;
|
|
|
|
/* interval requested ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((!pData->bFreezing) && (iInterval))
|
2000-08-08 07:58:05 +04:00
|
|
|
{ /* setup the timer */
|
|
|
|
mng_retcode iRetcode = set_delay (pData, iInterval);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * * */
|
|
|
|
/* * Generic display routines * */
|
|
|
|
/* * * */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode interframe_delay (mng_datap pData)
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_uint32 iWaitfor = 0;
|
2000-08-08 07:58:05 +04:00
|
|
|
mng_uint32 iInterval;
|
|
|
|
mng_uint32 iRuninterval;
|
|
|
|
mng_retcode iRetcode;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
if (!pData->bSearching) /* we mustn't be searching !!! */
|
2000-11-29 09:45:16 +03:00
|
|
|
{
|
|
|
|
if (pData->iFramedelay > 0) /* real delay ? */
|
2000-08-08 07:58:05 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((pData->bRunning) && /* let the app refresh first ? */
|
|
|
|
(pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright))
|
2000-08-08 07:58:05 +04:00
|
|
|
if (!pData->fRefresh (((mng_handle)pData),
|
|
|
|
pData->iUpdateleft, pData->iUpdatetop,
|
|
|
|
pData->iUpdateright - pData->iUpdateleft,
|
|
|
|
pData->iUpdatebottom - pData->iUpdatetop))
|
|
|
|
MNG_ERROR (pData, MNG_APPMISCERROR)
|
|
|
|
|
|
|
|
pData->iUpdateleft = 0; /* reset update-region */
|
|
|
|
pData->iUpdateright = 0;
|
|
|
|
pData->iUpdatetop = 0;
|
|
|
|
pData->iUpdatebottom = 0; /* reset refreshneeded indicator */
|
|
|
|
pData->bNeedrefresh = MNG_FALSE;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* get current tickcount */
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iRuntime = pData->fGettickcount ((mng_handle)pData);
|
2000-08-08 07:58:05 +04:00
|
|
|
/* calculate interval since last sync-point */
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->iRuntime < pData->iSynctime)
|
|
|
|
iRuninterval = pData->iRuntime + ~pData->iSynctime + 1;
|
|
|
|
else
|
|
|
|
iRuninterval = pData->iRuntime - pData->iSynctime;
|
2000-08-08 07:58:05 +04:00
|
|
|
/* calculate actual run-time */
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->iRuntime < pData->iStarttime)
|
|
|
|
pData->iRuntime = pData->iRuntime + ~pData->iStarttime + 1;
|
|
|
|
else
|
|
|
|
pData->iRuntime = pData->iRuntime - pData->iStarttime;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->iTicks) /* what are we aiming for */
|
2000-08-08 07:58:05 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pData->iSpeed) /* honor speed modifier */
|
|
|
|
{
|
|
|
|
case mng_st_fast :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)(( 500 * pData->iFramedelay) / pData->iTicks);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mng_st_slow :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)((3000 * pData->iFramedelay) / pData->iTicks);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mng_st_slowest :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)((8000 * pData->iFramedelay) / pData->iTicks);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)((1000 * pData->iFramedelay) / pData->iTicks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pData->eImagetype == mng_it_mng)
|
|
|
|
iWaitfor = 1000;
|
|
|
|
else
|
|
|
|
iWaitfor = 1;
|
2000-08-08 07:58:05 +04:00
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iWaitfor > iRuninterval) /* delay necessary ? */
|
|
|
|
iInterval = iWaitfor - iRuninterval;
|
|
|
|
else
|
|
|
|
iInterval = 1; /* force app to process messageloop */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bRunning) /* set the timer ? */
|
|
|
|
{
|
|
|
|
iRetcode = set_delay (pData, iInterval);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->bRunning) /* increase frametime in advance */
|
|
|
|
pData->iFrametime = pData->iFrametime + iWaitfor;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* setup for next delay */
|
2000-08-08 07:58:05 +04:00
|
|
|
pData->iFramedelay = pData->iNextdelay;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
void set_display_routine (mng_datap pData)
|
2000-11-29 09:45:16 +03:00
|
|
|
{ /* actively running ? */
|
|
|
|
if ((pData->bRunning) && (!pData->bFreezing))
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pData->iCanvasstyle) /* determine display routine */
|
|
|
|
{
|
2001-05-20 21:36:25 +04:00
|
|
|
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_BGRA8PM : { pData->fDisplayrow = (mng_fptr)display_bgra8_pm; 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; } */
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2001-01-30 04:04:13 +03:00
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode load_bkgdlayer (mng_datap pData)
|
|
|
|
{
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_START)
|
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
/* actively running ? */
|
|
|
|
if ((pData->bRunning) && (!pData->bFreezing))
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_int32 iY;
|
|
|
|
mng_retcode iRetcode; /* save values */
|
|
|
|
mng_int32 iDestl = pData->iDestl;
|
|
|
|
mng_int32 iDestr = pData->iDestr;
|
|
|
|
mng_int32 iDestt = pData->iDestt;
|
|
|
|
mng_int32 iDestb = pData->iDestb;
|
|
|
|
mng_int32 iSourcel = pData->iSourcel;
|
|
|
|
mng_int32 iSourcer = pData->iSourcer;
|
|
|
|
mng_int32 iSourcet = pData->iSourcet;
|
|
|
|
mng_int32 iSourceb = pData->iSourceb;
|
|
|
|
mng_int8 iPass = pData->iPass;
|
|
|
|
mng_int32 iRow = pData->iRow;
|
|
|
|
mng_int32 iRowinc = pData->iRowinc;
|
|
|
|
mng_int32 iCol = pData->iCol;
|
|
|
|
mng_int32 iColinc = pData->iColinc;
|
|
|
|
mng_int32 iRowsamples = pData->iRowsamples;
|
|
|
|
mng_int32 iRowsize = pData->iRowsize;
|
|
|
|
mng_bool bIsRGBA16 = pData->bIsRGBA16;
|
|
|
|
mng_bool bIsOpaque = pData->bIsOpaque;
|
2001-01-30 04:04:13 +03:00
|
|
|
mng_fptr fCorrectrow = pData->fCorrectrow;
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
pData->iDestl = 0; /* determine clipping region */
|
|
|
|
pData->iDestt = 0;
|
|
|
|
pData->iDestr = pData->iWidth;
|
|
|
|
pData->iDestb = pData->iHeight;
|
|
|
|
|
|
|
|
if (pData->bFrameclipping) /* frame clipping specified ? */
|
|
|
|
{
|
|
|
|
pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl);
|
|
|
|
pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt);
|
|
|
|
pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr);
|
|
|
|
pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb);
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
/* anything to clear ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt))
|
|
|
|
{
|
|
|
|
pData->iPass = -1; /* these are the object's dimensions now */
|
|
|
|
pData->iRow = 0;
|
|
|
|
pData->iRowinc = 1;
|
|
|
|
pData->iCol = 0;
|
|
|
|
pData->iColinc = 1;
|
|
|
|
pData->iRowsamples = pData->iWidth;
|
|
|
|
pData->iRowsize = pData->iRowsamples << 2;
|
|
|
|
pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */
|
|
|
|
pData->bIsOpaque = MNG_TRUE;
|
|
|
|
|
|
|
|
pData->iSourcel = 0; /* source relative to destination */
|
|
|
|
pData->iSourcer = pData->iDestr - pData->iDestl;
|
|
|
|
pData->iSourcet = 0;
|
|
|
|
pData->iSourceb = pData->iDestb - pData->iDestt;
|
|
|
|
|
|
|
|
set_display_routine (pData); /* determine display routine */
|
2000-06-13 03:06:35 +04:00
|
|
|
/* default restore using preset BG color */
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRestbkgdrow = (mng_fptr)restore_bkgd_bgcolor;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) &&
|
|
|
|
(pData->bUseBKGD))
|
|
|
|
{ /* prefer bKGD in PNG/JNG */
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
|
|
|
|
|
|
|
if (!pImage)
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
|
|
|
|
|
|
|
if (pImage->pImgbuf->bHasBKGD)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRestbkgdrow = (mng_fptr)restore_bkgd_bkgd;
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->fGetbkgdline) /* background-canvas-access callback set ? */
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pData->iBkgdstyle)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
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; } */
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bHasBACK)
|
|
|
|
{ /* background image ? */
|
|
|
|
if ((pData->iBACKmandatory & 0x02) && (pData->iBACKimageid))
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRestbkgdrow = (mng_fptr)restore_bkgd_backimage;
|
2000-11-29 09:45:16 +03:00
|
|
|
else /* background color ? */
|
|
|
|
if (pData->iBACKmandatory & 0x01)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRestbkgdrow = (mng_fptr)restore_bkgd_backcolor;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fCorrectrow = MNG_NULL; /* default no color-correction */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
/* TODO: determine color correction; this is tricky;
|
|
|
|
the BACK color is treated differently as the image;
|
|
|
|
it probably requires a rewrite of the logic here... */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* get a temporary row-buffer */
|
2000-11-29 09:45:16 +03:00
|
|
|
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize)
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
iY = pData->iDestt; /* this is where we start */
|
|
|
|
iRetcode = MNG_NOERROR; /* so far, so good */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
while ((!iRetcode) && (iY < pData->iDestb))
|
|
|
|
{ /* restore a background row */
|
|
|
|
iRetcode = ((mng_restbkgdrow)pData->fRestbkgdrow) (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
/* color correction ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((!iRetcode) && (pData->fCorrectrow))
|
|
|
|
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!iRetcode) /* so... display it */
|
|
|
|
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!iRetcode)
|
|
|
|
iRetcode = next_row (pData); /* adjust variables for next row */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
iY++; /* and next line */
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
/* drop the temporary row-buffer */
|
2000-11-29 09:45:16 +03:00
|
|
|
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize)
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iDestl = iDestl; /* restore values */
|
|
|
|
pData->iDestr = iDestr;
|
|
|
|
pData->iDestt = iDestt;
|
|
|
|
pData->iDestb = iDestb;
|
|
|
|
pData->iSourcel = iSourcel;
|
|
|
|
pData->iSourcer = iSourcer;
|
|
|
|
pData->iSourcet = iSourcet;
|
|
|
|
pData->iSourceb = iSourceb;
|
|
|
|
pData->iPass = iPass;
|
|
|
|
pData->iRow = iRow;
|
|
|
|
pData->iRowinc = iRowinc;
|
|
|
|
pData->iCol = iCol;
|
|
|
|
pData->iColinc = iColinc;
|
|
|
|
pData->iRowsamples = iRowsamples;
|
|
|
|
pData->iRowsize = iRowsize;
|
|
|
|
pData->bIsRGBA16 = bIsRGBA16;
|
|
|
|
pData->bIsOpaque = bIsOpaque;
|
|
|
|
pData->fCorrectrow = fCorrectrow;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
mng_retcode clear_canvas (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_int32 iY;
|
|
|
|
mng_retcode iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pData->iDestl = 0; /* clipping region is full canvas! */
|
|
|
|
pData->iDestt = 0;
|
|
|
|
pData->iDestr = pData->iWidth;
|
|
|
|
pData->iDestb = pData->iHeight;
|
|
|
|
|
|
|
|
pData->iSourcel = 0; /* source is same as destination */
|
|
|
|
pData->iSourcer = pData->iWidth;
|
|
|
|
pData->iSourcet = 0;
|
|
|
|
pData->iSourceb = pData->iHeight;
|
|
|
|
|
|
|
|
pData->iPass = -1; /* these are the object's dimensions now */
|
|
|
|
pData->iRow = 0;
|
|
|
|
pData->iRowinc = 1;
|
|
|
|
pData->iCol = 0;
|
|
|
|
pData->iColinc = 1;
|
|
|
|
pData->iRowsamples = pData->iWidth;
|
|
|
|
pData->iRowsize = pData->iRowsamples << 2;
|
|
|
|
pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */
|
|
|
|
pData->bIsOpaque = MNG_TRUE;
|
|
|
|
|
|
|
|
set_display_routine (pData); /* determine display routine */
|
|
|
|
/* get a temporary row-buffer */
|
|
|
|
/* it's transparent black by default!! */
|
|
|
|
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize)
|
|
|
|
|
|
|
|
iY = pData->iDestt; /* this is where we start */
|
|
|
|
iRetcode = MNG_NOERROR; /* so far, so good */
|
|
|
|
|
|
|
|
while ((!iRetcode) && (iY < pData->iDestb))
|
|
|
|
{ /* clear a row then */
|
|
|
|
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
|
|
|
|
|
|
|
|
if (!iRetcode)
|
|
|
|
iRetcode = next_row (pData); /* adjust variables for next row */
|
|
|
|
|
|
|
|
iY++; /* and next line */
|
|
|
|
}
|
|
|
|
/* drop the temporary row-buffer */
|
|
|
|
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize)
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
mng_retcode next_frame (mng_datap pData,
|
|
|
|
mng_uint8 iFramemode,
|
|
|
|
mng_uint8 iChangedelay,
|
|
|
|
mng_uint32 iDelay,
|
|
|
|
mng_uint8 iChangetimeout,
|
|
|
|
mng_uint32 iTimeout,
|
|
|
|
mng_uint8 iChangeclipping,
|
|
|
|
mng_uint8 iCliptype,
|
|
|
|
mng_int32 iClipl,
|
|
|
|
mng_int32 iClipr,
|
|
|
|
mng_int32 iClipt,
|
|
|
|
mng_int32 iClipb)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->iBreakpoint) /* no previous break here ? */
|
|
|
|
{
|
|
|
|
mng_uint8 iOldmode = pData->iFramemode;
|
|
|
|
/* interframe delay required ? */
|
|
|
|
if ((iOldmode == 2) || (iOldmode == 4))
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
/* changed here because FRAM 1/3 will delay themselves before each image */
|
|
|
|
if ((pData->iFrameseq) && (iFramemode != 1) && (iFramemode != 3))
|
2000-06-13 03:06:35 +04:00
|
|
|
iRetcode = interframe_delay (pData);
|
|
|
|
else
|
|
|
|
pData->iFramedelay = pData->iNextdelay;
|
|
|
|
}
|
2001-01-30 04:04:13 +03:00
|
|
|
else
|
2001-05-20 21:36:25 +04:00
|
|
|
{ /* delay before inserting background layer? */
|
|
|
|
if ((pData->bFramedone) && (iFramemode == 4))
|
2001-01-30 04:04:13 +03:00
|
|
|
iRetcode = interframe_delay (pData);
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
/* now we'll assume we're in the next frame! */
|
|
|
|
if (iFramemode) /* save the new framing mode ? */
|
|
|
|
{
|
|
|
|
pData->iFRAMmode = iFramemode;
|
|
|
|
pData->iFramemode = iFramemode;
|
|
|
|
}
|
|
|
|
else /* reload default */
|
|
|
|
pData->iFramemode = pData->iFRAMmode;
|
|
|
|
|
|
|
|
if (iChangedelay) /* delay changed ? */
|
|
|
|
{
|
|
|
|
pData->iNextdelay = iDelay; /* for *after* next subframe */
|
|
|
|
|
|
|
|
if ((iOldmode == 2) || (iOldmode == 4))
|
2001-05-20 21:36:25 +04:00
|
|
|
/* pData->iFramedelay = iDelay; */
|
|
|
|
pData->iFramedelay = pData->iFRAMdelay;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
if (iChangedelay == 2) /* also overall ? */
|
|
|
|
pData->iFRAMdelay = iDelay;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* reload default */
|
|
|
|
pData->iNextdelay = pData->iFRAMdelay;
|
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
/* if ((iOldmode == 2) || (iOldmode == 4))
|
|
|
|
pData->iFramedelay = pData->iNextdelay; */
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iChangetimeout) /* timeout changed ? */
|
|
|
|
{ /* for next subframe */
|
|
|
|
pData->iFrametimeout = iTimeout;
|
|
|
|
|
|
|
|
if ((iChangetimeout == 2) || /* also overall ? */
|
|
|
|
(iChangetimeout == 4) ||
|
|
|
|
(iChangetimeout == 6) ||
|
|
|
|
(iChangetimeout == 8))
|
|
|
|
pData->iFRAMtimeout = iTimeout;
|
|
|
|
}
|
|
|
|
else /* reload default */
|
|
|
|
pData->iFrametimeout = pData->iFRAMtimeout;
|
|
|
|
|
|
|
|
if (iChangeclipping) /* clipping changed ? */
|
|
|
|
{
|
|
|
|
pData->bFrameclipping = MNG_TRUE;
|
|
|
|
|
|
|
|
if (!iCliptype) /* absolute ? */
|
|
|
|
{
|
|
|
|
pData->iFrameclipl = iClipl;
|
|
|
|
pData->iFrameclipr = iClipr;
|
|
|
|
pData->iFrameclipt = iClipt;
|
|
|
|
pData->iFrameclipb = iClipb;
|
|
|
|
}
|
|
|
|
else /* relative */
|
|
|
|
{
|
|
|
|
pData->iFrameclipl = pData->iFrameclipl + iClipl;
|
|
|
|
pData->iFrameclipr = pData->iFrameclipr + iClipr;
|
|
|
|
pData->iFrameclipt = pData->iFrameclipt + iClipt;
|
|
|
|
pData->iFrameclipb = pData->iFrameclipb + iClipb;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iChangeclipping == 2) /* also overall ? */
|
|
|
|
{
|
|
|
|
pData->bFRAMclipping = MNG_TRUE;
|
|
|
|
|
|
|
|
if (!iCliptype) /* absolute ? */
|
|
|
|
{
|
|
|
|
pData->iFRAMclipl = iClipl;
|
|
|
|
pData->iFRAMclipr = iClipr;
|
|
|
|
pData->iFRAMclipt = iClipt;
|
|
|
|
pData->iFRAMclipb = iClipb;
|
|
|
|
}
|
|
|
|
else /* relative */
|
|
|
|
{
|
|
|
|
pData->iFRAMclipl = pData->iFRAMclipl + iClipl;
|
|
|
|
pData->iFRAMclipr = pData->iFRAMclipr + iClipr;
|
|
|
|
pData->iFRAMclipt = pData->iFRAMclipt + iClipt;
|
|
|
|
pData->iFRAMclipb = pData->iFRAMclipb + iClipb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* reload defaults */
|
|
|
|
pData->bFrameclipping = pData->bFRAMclipping;
|
|
|
|
pData->iFrameclipl = pData->iFRAMclipl;
|
|
|
|
pData->iFrameclipr = pData->iFRAMclipr;
|
|
|
|
pData->iFrameclipt = pData->iFRAMclipt;
|
|
|
|
pData->iFrameclipb = pData->iFRAMclipb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bTimerset) /* timer still off ? */
|
|
|
|
{
|
|
|
|
if ((pData->iFramemode == 4) || /* insert background layer after a new frame */
|
|
|
|
(!pData->iLayerseq)) /* and certainly before the very first layer */
|
|
|
|
iRetcode = load_bkgdlayer (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((pData->bDisplaying) && (pData->bRunning))
|
2001-05-20 21:36:25 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iFrameseq++; /* count the frame ! */
|
2001-05-20 21:36:25 +04:00
|
|
|
pData->bFramedone = MNG_TRUE; /* and indicate we've done one */
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode next_layer (mng_datap pData)
|
|
|
|
{
|
2000-06-24 02:59:51 +04:00
|
|
|
mng_imagep pImage;
|
2000-06-13 03:06:35 +04:00
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->iBreakpoint) /* no previous break here ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
{ /* interframe delay required ? */
|
|
|
|
if ((pData->eImagetype == mng_it_mng) && (pData->iLayerseq) &&
|
2000-06-13 03:06:35 +04:00
|
|
|
((pData->iFramemode == 1) || (pData->iFramemode == 3)))
|
|
|
|
iRetcode = interframe_delay (pData);
|
|
|
|
else
|
|
|
|
pData->iFramedelay = pData->iNextdelay;
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bTimerset) /* timer still off ? */
|
|
|
|
{
|
|
|
|
if (!pData->iLayerseq) /* restore background for the very first layer ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
{ /* wait till IDAT/JDAT for PNGs & JNGs !!! */
|
|
|
|
if ((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng))
|
|
|
|
pData->bRestorebkgd = MNG_TRUE;
|
|
|
|
else
|
|
|
|
{ /* for MNG we do it right away */
|
|
|
|
iRetcode = load_bkgdlayer (pData);
|
|
|
|
|
|
|
|
if (pData->bRunning)
|
|
|
|
pData->iLayerseq++; /* and it counts as a layer then ! */
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if (pData->iFramemode == 3) /* restore background for each layer ? */
|
|
|
|
iRetcode = load_bkgdlayer (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
if (pData->bHasDHDR) /* processing a delta-image ? */
|
|
|
|
pImage = (mng_imagep)pData->pDeltaImage;
|
|
|
|
else
|
|
|
|
pImage = (mng_imagep)pData->pCurrentobj;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
if (!pImage) /* not an active object ? */
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
|
|
|
/* determine display rectangle */
|
|
|
|
pData->iDestl = MAX_COORD ((mng_int32)0, pImage->iPosx);
|
|
|
|
pData->iDestt = MAX_COORD ((mng_int32)0, pImage->iPosy);
|
|
|
|
/* is it a valid buffer ? */
|
|
|
|
if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight))
|
|
|
|
{
|
|
|
|
pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth,
|
|
|
|
pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth );
|
|
|
|
pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight,
|
|
|
|
pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight);
|
|
|
|
}
|
|
|
|
else /* it's a single image ! */
|
|
|
|
{
|
|
|
|
pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth,
|
|
|
|
(mng_int32)pData->iDatawidth );
|
|
|
|
pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight,
|
|
|
|
(mng_int32)pData->iDataheight);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->bFrameclipping) /* frame clipping specified ? */
|
|
|
|
{
|
|
|
|
pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl);
|
|
|
|
pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt);
|
|
|
|
pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr);
|
|
|
|
pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pImage->bClipped) /* is the image clipped itself ? */
|
|
|
|
{
|
|
|
|
pData->iDestl = MAX_COORD (pData->iDestl, pImage->iClipl);
|
|
|
|
pData->iDestt = MAX_COORD (pData->iDestt, pImage->iClipt);
|
|
|
|
pData->iDestr = MIN_COORD (pData->iDestr, pImage->iClipr);
|
|
|
|
pData->iDestb = MIN_COORD (pData->iDestb, pImage->iClipb);
|
|
|
|
}
|
|
|
|
/* determine source starting point */
|
|
|
|
pData->iSourcel = MAX_COORD ((mng_int32)0, pData->iDestl - pImage->iPosx);
|
|
|
|
pData->iSourcet = MAX_COORD ((mng_int32)0, pData->iDestt - pImage->iPosy);
|
|
|
|
|
|
|
|
if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight))
|
|
|
|
{ /* and maximum size */
|
|
|
|
pData->iSourcer = MIN_COORD ((mng_int32)pImage->pImgbuf->iWidth,
|
|
|
|
pData->iSourcel + pData->iDestr - pData->iDestl);
|
|
|
|
pData->iSourceb = MIN_COORD ((mng_int32)pImage->pImgbuf->iHeight,
|
|
|
|
pData->iSourcet + pData->iDestb - pData->iDestt);
|
|
|
|
}
|
|
|
|
else /* it's a single image ! */
|
|
|
|
{
|
|
|
|
pData->iSourcer = pData->iSourcel + pData->iDestr - pData->iDestl;
|
|
|
|
pData->iSourceb = pData->iSourcet + pData->iDestb - pData->iDestt;
|
|
|
|
}
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bRunning)
|
|
|
|
pData->iLayerseq++; /* count the layer ! */
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode display_image (mng_datap pData,
|
|
|
|
mng_imagep pImage,
|
|
|
|
mng_bool bLayeradvanced)
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_retcode iRetcode;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_START)
|
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
/* actively running ? */
|
|
|
|
if ((pData->bRunning) && (!pData->bFreezing))
|
|
|
|
{
|
|
|
|
if ( (!pData->iBreakpoint) && /* needs magnification ? */
|
|
|
|
( (pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY) ) )
|
|
|
|
{
|
|
|
|
iRetcode = magnify_imageobject (pData, pImage);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pData->pRetrieveobj = pImage; /* so retrieve-row and color-correction can find it */
|
|
|
|
|
|
|
|
if (!bLayeradvanced) /* need to advance the layer ? */
|
|
|
|
{
|
|
|
|
mng_imagep pSave = pData->pCurrentobj;
|
|
|
|
pData->pCurrentobj = pImage;
|
|
|
|
next_layer (pData); /* advance to next layer */
|
|
|
|
pData->pCurrentobj = pSave;
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
/* need to restore the background ? */
|
|
|
|
if ((!pData->bTimerset) && (pData->bRestorebkgd))
|
|
|
|
{
|
|
|
|
mng_imagep pSave = pData->pCurrentobj;
|
|
|
|
pData->pCurrentobj = pImage;
|
|
|
|
pData->bRestorebkgd = MNG_FALSE;
|
|
|
|
iRetcode = load_bkgdlayer (pData);
|
|
|
|
pData->pCurrentobj = pSave;
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bRunning)
|
|
|
|
pData->iLayerseq++; /* and it counts as a layer then ! */
|
|
|
|
}
|
|
|
|
/* actively running ? */
|
|
|
|
if ((pData->bRunning) && (!pData->bFreezing))
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!pData->bTimerset) /* all systems still go ? */
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iBreakpoint = 0; /* let's make absolutely sure... */
|
|
|
|
/* anything to display ? */
|
|
|
|
if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt))
|
|
|
|
{
|
|
|
|
mng_int32 iY;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
set_display_routine (pData); /* determine display routine */
|
2000-06-13 03:06:35 +04:00
|
|
|
/* and image-buffer retrieval routine */
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pImage->pImgbuf->iColortype)
|
|
|
|
{
|
|
|
|
case 0 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_g16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_g8;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
|
|
|
|
break;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 2 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgb16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgb8;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
|
|
|
|
break;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
case 3 : { pData->fRetrieverow = (mng_fptr)retrieve_idx8;
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS);
|
|
|
|
break;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 4 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_ga16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_ga8;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 6 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgba16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgba8;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2000-06-14 18:20:55 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 8 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_g16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_g8;
|
2000-06-14 18:20:55 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = MNG_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2000-06-14 18:20:55 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 10 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgb16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgb8;
|
2000-06-14 18:20:55 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = MNG_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2000-06-14 18:20:55 +04:00
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 12 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_ga16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_ga8;
|
2000-06-14 18:20:55 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2000-06-14 18:20:55 +04:00
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
case 14 : { if (pImage->pImgbuf->iBitdepth > 8)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgba16;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgba8;
|
2000-06-14 18:20:55 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bIsOpaque = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPass = -1; /* these are the object's dimensions now */
|
|
|
|
pData->iRow = pData->iSourcet;
|
|
|
|
pData->iRowinc = 1;
|
|
|
|
pData->iCol = 0;
|
|
|
|
pData->iColinc = 1;
|
|
|
|
pData->iRowsamples = pImage->pImgbuf->iWidth;
|
|
|
|
pData->iRowsize = pData->iRowsamples << 2;
|
|
|
|
pData->bIsRGBA16 = MNG_FALSE;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* adjust for 16-bit object ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pImage->pImgbuf->iBitdepth > 8)
|
|
|
|
{
|
|
|
|
pData->bIsRGBA16 = MNG_TRUE;
|
|
|
|
pData->iRowsize = pData->iRowsamples << 3;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fCorrectrow = MNG_NULL; /* default no color-correction */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
#ifdef MNG_NO_CMS
|
|
|
|
iRetcode = MNG_NOERROR;
|
|
|
|
#else
|
2000-06-13 03:06:35 +04:00
|
|
|
#if defined(MNG_FULL_CMS) /* determine color-management routine */
|
2000-11-29 09:45:16 +03:00
|
|
|
iRetcode = init_full_cms_object (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
#elif defined(MNG_GAMMA_ONLY)
|
2000-11-29 09:45:16 +03:00
|
|
|
iRetcode = init_gamma_only_object (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
#elif defined(MNG_APP_CMS)
|
2000-11-29 09:45:16 +03:00
|
|
|
iRetcode = init_app_cms_object (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
#endif /* MNG_NO_CMS */
|
2000-06-13 03:06:35 +04:00
|
|
|
/* get a temporary row-buffer */
|
2000-11-29 09:45:16 +03:00
|
|
|
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize)
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
iY = pData->iSourcet; /* this is where we start */
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
while ((!iRetcode) && (iY < pData->iSourceb))
|
|
|
|
{ /* get a row */
|
|
|
|
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
/* color correction ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((!iRetcode) && (pData->fCorrectrow))
|
|
|
|
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!iRetcode) /* so... display it */
|
|
|
|
iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!iRetcode) /* adjust variables for next row */
|
|
|
|
iRetcode = next_row (pData);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
iY++; /* and next line */
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
/* drop the temporary row-buffer */
|
2000-11-29 09:45:16 +03:00
|
|
|
MNG_FREE (pData, pData->pRGBArow, pData->iRowsize)
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2001-05-20 21:36:25 +04:00
|
|
|
|
|
|
|
#if defined(MNG_INCLUDE_LCMS) /* cleanup cms stuff */
|
|
|
|
iRetcode = mng_clear_cms (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR; /* whehehe, this is good ! */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
mng_retcode execute_delta_image (mng_datap pData,
|
|
|
|
mng_imagep pTarget,
|
|
|
|
mng_imagep pDelta)
|
|
|
|
{
|
|
|
|
mng_imagedatap pBuftarget = pTarget->pImgbuf;
|
|
|
|
mng_imagedatap pBufdelta = pDelta->pImgbuf;
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_uint32 iY;
|
|
|
|
mng_retcode iRetcode;
|
2000-06-24 02:59:51 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_START)
|
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
/* actively running ? */
|
|
|
|
if ((pData->bRunning) && (!pData->bFreezing))
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasPLTE) /* palette in delta ? */
|
|
|
|
{
|
|
|
|
mng_uint32 iX;
|
2000-06-24 02:59:51 +04:00
|
|
|
/* new palette larger than old one ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((!pBuftarget->bHasPLTE) || (pBuftarget->iPLTEcount < pBufdelta->iPLTEcount))
|
|
|
|
pBuftarget->iPLTEcount = pBufdelta->iPLTEcount;
|
2000-06-24 02:59:51 +04:00
|
|
|
/* it's definitely got a PLTE now */
|
2000-11-29 09:45:16 +03:00
|
|
|
pBuftarget->bHasPLTE = MNG_TRUE;
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
for (iX = 0; iX < pBufdelta->iPLTEcount; iX++)
|
|
|
|
{
|
|
|
|
pBuftarget->aPLTEentries[iX].iRed = pBufdelta->aPLTEentries[iX].iRed;
|
|
|
|
pBuftarget->aPLTEentries[iX].iGreen = pBufdelta->aPLTEentries[iX].iGreen;
|
|
|
|
pBuftarget->aPLTEentries[iX].iBlue = pBufdelta->aPLTEentries[iX].iBlue;
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasTRNS) /* cheap transparency in delta ? */
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pData->iColortype) /* drop it into the target */
|
|
|
|
{
|
|
|
|
case 0: { /* gray */
|
|
|
|
pBuftarget->iTRNSgray = pBufdelta->iTRNSgray;
|
|
|
|
pBuftarget->iTRNSred = 0;
|
|
|
|
pBuftarget->iTRNSgreen = 0;
|
|
|
|
pBuftarget->iTRNSblue = 0;
|
|
|
|
pBuftarget->iTRNScount = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2: { /* rgb */
|
|
|
|
pBuftarget->iTRNSgray = 0;
|
|
|
|
pBuftarget->iTRNSred = pBufdelta->iTRNSred;
|
|
|
|
pBuftarget->iTRNSgreen = pBufdelta->iTRNSgreen;
|
|
|
|
pBuftarget->iTRNSblue = pBufdelta->iTRNSblue;
|
|
|
|
pBuftarget->iTRNScount = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3: { /* indexed */
|
|
|
|
pBuftarget->iTRNSgray = 0;
|
|
|
|
pBuftarget->iTRNSred = 0;
|
|
|
|
pBuftarget->iTRNSgreen = 0;
|
|
|
|
pBuftarget->iTRNSblue = 0;
|
2000-06-24 02:59:51 +04:00
|
|
|
/* existing range smaller than new one ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((!pBuftarget->bHasTRNS) || (pBuftarget->iTRNScount < pBufdelta->iTRNScount))
|
|
|
|
pBuftarget->iTRNScount = pBufdelta->iTRNScount;
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
MNG_COPY (pBuftarget->aTRNSentries, pBufdelta->aTRNSentries, pBufdelta->iTRNScount)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pBuftarget->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasBKGD) /* bkgd in source ? */
|
|
|
|
{ /* drop it onto the target */
|
|
|
|
pBuftarget->bHasBKGD = MNG_TRUE;
|
|
|
|
pBuftarget->iBKGDindex = pBufdelta->iBKGDindex;
|
|
|
|
pBuftarget->iBKGDgray = pBufdelta->iBKGDgray;
|
|
|
|
pBuftarget->iBKGDred = pBufdelta->iBKGDred;
|
|
|
|
pBuftarget->iBKGDgreen = pBufdelta->iBKGDgreen;
|
|
|
|
pBuftarget->iBKGDblue = pBufdelta->iBKGDblue;
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasGAMA) /* gamma in source ? */
|
|
|
|
{
|
|
|
|
pBuftarget->bHasGAMA = MNG_TRUE; /* drop it onto the target */
|
|
|
|
pBuftarget->iGamma = pBufdelta->iGamma;
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasCHRM) /* chroma in delta ? */
|
|
|
|
{ /* drop it onto the target */
|
|
|
|
pBuftarget->bHasCHRM = MNG_TRUE;
|
|
|
|
pBuftarget->iWhitepointx = pBufdelta->iWhitepointx;
|
|
|
|
pBuftarget->iWhitepointy = pBufdelta->iWhitepointy;
|
|
|
|
pBuftarget->iPrimaryredx = pBufdelta->iPrimaryredx;
|
|
|
|
pBuftarget->iPrimaryredy = pBufdelta->iPrimaryredy;
|
|
|
|
pBuftarget->iPrimarygreenx = pBufdelta->iPrimarygreenx;
|
|
|
|
pBuftarget->iPrimarygreeny = pBufdelta->iPrimarygreeny;
|
|
|
|
pBuftarget->iPrimarybluex = pBufdelta->iPrimarybluex;
|
|
|
|
pBuftarget->iPrimarybluey = pBufdelta->iPrimarybluey;
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasSRGB) /* sRGB in delta ? */
|
|
|
|
{ /* drop it onto the target */
|
|
|
|
pBuftarget->bHasSRGB = MNG_TRUE;
|
|
|
|
pBuftarget->iRenderingintent = pBufdelta->iRenderingintent;
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBufdelta->bHasICCP) /* ICC profile in delta ? */
|
|
|
|
{
|
|
|
|
pBuftarget->bHasICCP = MNG_TRUE; /* drop it onto the target */
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pBuftarget->pProfile) /* profile existed ? */
|
|
|
|
MNG_FREEX (pData, pBuftarget->pProfile, pBuftarget->iProfilesize)
|
2000-06-24 02:59:51 +04:00
|
|
|
/* allocate a buffer & copy it */
|
2000-11-29 09:45:16 +03:00
|
|
|
MNG_ALLOC (pData, pBuftarget->pProfile, pBufdelta->iProfilesize)
|
|
|
|
MNG_COPY (pBuftarget->pProfile, pBufdelta->pProfile, pBufdelta->iProfilesize)
|
2000-06-24 02:59:51 +04:00
|
|
|
/* store it's length as well */
|
2000-11-29 09:45:16 +03:00
|
|
|
pBuftarget->iProfilesize = pBufdelta->iProfilesize;
|
|
|
|
}
|
|
|
|
/* need to execute delta pixels ? */
|
|
|
|
if ((!pData->bDeltaimmediate) && (pData->iDeltatype != MNG_DELTATYPE_NOCHANGE))
|
|
|
|
{
|
|
|
|
pData->fScalerow = MNG_NULL; /* not needed by default */
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pBuftarget->iBitdepth) /* determine scaling routine */
|
|
|
|
{
|
2000-06-24 02:59:51 +04:00
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->fDeltarow = MNG_NULL; /* let's assume there's nothing to do */
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
switch (pBuftarget->iColortype) /* determine delta processing routine */
|
|
|
|
{
|
|
|
|
case 0 : ;
|
|
|
|
case 8 : { /* gray */
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) ||
|
|
|
|
(pBufdelta->iColortype == 8))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
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; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2 : ;
|
|
|
|
case 10 : { /* rgb */
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_rgb8_rgb8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_rgb16_rgb16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3 : { /* indexed; abuse gray routines */
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
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; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 4 : ;
|
|
|
|
case 12 : { /* gray + alpha */
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 4) || (pBufdelta->iColortype == 12))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_ga8_ga8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_ga16_ga16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) ||
|
|
|
|
(pBufdelta->iColortype == 8))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_ga8_g8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_ga16_g16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_ga8_a8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_ga16_a16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 6 : ;
|
|
|
|
case 14 : { /* rgb + alpha */
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 6) || (pBufdelta->iColortype == 14))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_rgba8_rgba8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_rgba16_rgba16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_rgba8_rgb8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_rgba16_rgb16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
|
|
|
|
{
|
|
|
|
if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3))
|
|
|
|
{
|
|
|
|
switch (pBuftarget->iBitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
case 8 : { pData->fDeltarow = (mng_fptr)delta_rgba8_a8; break; }
|
|
|
|
case 16 : { pData->fDeltarow = (mng_fptr)delta_rgba16_a16; break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->fDeltarow) /* do we need to take action ? */
|
|
|
|
{
|
|
|
|
pData->iPass = -1; /* setup row dimensions and stuff */
|
|
|
|
pData->iRow = pData->iDeltaBlocky;
|
|
|
|
pData->iRowinc = 1;
|
|
|
|
pData->iCol = pData->iDeltaBlockx;
|
|
|
|
pData->iColinc = 1;
|
|
|
|
pData->iRowsamples = pBufdelta->iWidth;
|
|
|
|
pData->iRowsize = pBuftarget->iRowsize;
|
|
|
|
/* indicate where to retrieve & where to store */
|
|
|
|
pData->pRetrieveobj = (mng_objectp)pDelta;
|
|
|
|
pData->pStoreobj = (mng_objectp)pTarget;
|
2001-11-01 03:19:53 +03:00
|
|
|
|
|
|
|
if (pData->pRGBArow) /* prevent duplicate allocation! */
|
|
|
|
MNG_FREE (pData, pData->pRGBArow, (pData->iDatawidth << 3))
|
2000-11-29 09:45:16 +03:00
|
|
|
/* get a temporary row-buffer */
|
|
|
|
MNG_ALLOC (pData, pData->pRGBArow, pBufdelta->iRowsize)
|
|
|
|
|
|
|
|
iY = 0; /* this is where we start */
|
|
|
|
iRetcode = MNG_NOERROR; /* still oke for now */
|
|
|
|
|
|
|
|
while ((!iRetcode) && (iY < pBufdelta->iHeight))
|
|
|
|
{ /* get a row */
|
|
|
|
mng_uint8p pWork = pBufdelta->pImgdata + (iY * pBufdelta->iRowsize);
|
|
|
|
|
|
|
|
MNG_COPY (pData->pRGBArow, pWork, pBufdelta->iRowsize);
|
|
|
|
|
|
|
|
if (pData->fScalerow) /* scale it (if necessary) */
|
|
|
|
iRetcode = ((mng_scalerow)pData->fScalerow) (pData);
|
|
|
|
|
|
|
|
if (!iRetcode) /* and... execute it */
|
|
|
|
iRetcode = ((mng_deltarow)pData->fDeltarow) (pData);
|
|
|
|
|
|
|
|
if (!iRetcode) /* adjust variables for next row */
|
|
|
|
iRetcode = next_row (pData);
|
|
|
|
|
|
|
|
iY++; /* and next line */
|
|
|
|
}
|
|
|
|
/* drop the temporary row-buffer */
|
|
|
|
MNG_FREE (pData, pData->pRGBArow, pBufdelta->iRowsize)
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
MNG_ERROR (pData, MNG_INVALIDDELTA)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
mng_retcode save_state (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_savedatap pSave;
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pData->pSavedata) /* sanity check */
|
|
|
|
MNG_ERROR (pData, MNG_INTERNALERROR)
|
|
|
|
/* get a buffer for saving */
|
|
|
|
MNG_ALLOC (pData, pData->pSavedata, sizeof (mng_savedata))
|
|
|
|
|
|
|
|
pSave = pData->pSavedata; /* address it more directly */
|
|
|
|
/* and copy global data from the main struct */
|
|
|
|
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
|
|
|
pSave->bHasglobalPLTE = pData->bHasglobalPLTE;
|
|
|
|
pSave->bHasglobalTRNS = pData->bHasglobalTRNS;
|
|
|
|
pSave->bHasglobalGAMA = pData->bHasglobalGAMA;
|
|
|
|
pSave->bHasglobalCHRM = pData->bHasglobalCHRM;
|
|
|
|
pSave->bHasglobalSRGB = pData->bHasglobalSRGB;
|
|
|
|
pSave->bHasglobalICCP = pData->bHasglobalICCP;
|
|
|
|
pSave->bHasglobalBKGD = pData->bHasglobalBKGD;
|
|
|
|
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
|
|
|
|
|
|
|
pSave->iBACKred = pData->iBACKred;
|
|
|
|
pSave->iBACKgreen = pData->iBACKgreen;
|
|
|
|
pSave->iBACKblue = pData->iBACKblue;
|
|
|
|
pSave->iBACKmandatory = pData->iBACKmandatory;
|
|
|
|
pSave->iBACKimageid = pData->iBACKimageid;
|
|
|
|
pSave->iBACKtile = pData->iBACKtile;
|
|
|
|
|
|
|
|
pSave->iFRAMmode = pData->iFRAMmode;
|
|
|
|
pSave->iFRAMdelay = pData->iFRAMdelay;
|
|
|
|
pSave->iFRAMtimeout = pData->iFRAMtimeout;
|
|
|
|
pSave->bFRAMclipping = pData->bFRAMclipping;
|
|
|
|
pSave->iFRAMclipl = pData->iFRAMclipl;
|
|
|
|
pSave->iFRAMclipr = pData->iFRAMclipr;
|
|
|
|
pSave->iFRAMclipt = pData->iFRAMclipt;
|
|
|
|
pSave->iFRAMclipb = pData->iFRAMclipb;
|
|
|
|
|
|
|
|
pSave->iGlobalPLTEcount = pData->iGlobalPLTEcount;
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
MNG_COPY (pSave->aGlobalPLTEentries, pData->aGlobalPLTEentries, sizeof (mng_rgbpaltab))
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pSave->iGlobalTRNSrawlen = pData->iGlobalTRNSrawlen;
|
2000-08-08 07:58:05 +04:00
|
|
|
MNG_COPY (pSave->aGlobalTRNSrawdata, pData->aGlobalTRNSrawdata, 256)
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pSave->iGlobalGamma = pData->iGlobalGamma;
|
|
|
|
|
|
|
|
pSave->iGlobalWhitepointx = pData->iGlobalWhitepointx;
|
|
|
|
pSave->iGlobalWhitepointy = pData->iGlobalWhitepointy;
|
|
|
|
pSave->iGlobalPrimaryredx = pData->iGlobalPrimaryredx;
|
|
|
|
pSave->iGlobalPrimaryredy = pData->iGlobalPrimaryredy;
|
|
|
|
pSave->iGlobalPrimarygreenx = pData->iGlobalPrimarygreenx;
|
|
|
|
pSave->iGlobalPrimarygreeny = pData->iGlobalPrimarygreeny;
|
|
|
|
pSave->iGlobalPrimarybluex = pData->iGlobalPrimarybluex;
|
|
|
|
pSave->iGlobalPrimarybluey = pData->iGlobalPrimarybluey;
|
|
|
|
|
|
|
|
pSave->iGlobalRendintent = pData->iGlobalRendintent;
|
|
|
|
|
|
|
|
pSave->iGlobalProfilesize = pData->iGlobalProfilesize;
|
|
|
|
|
|
|
|
if (pSave->iGlobalProfilesize) /* has a profile ? */
|
|
|
|
{ /* then copy that ! */
|
|
|
|
MNG_ALLOC (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize)
|
|
|
|
MNG_COPY (pSave->pGlobalProfile, pData->pGlobalProfile, pSave->iGlobalProfilesize)
|
|
|
|
}
|
|
|
|
|
|
|
|
pSave->iGlobalBKGDred = pData->iGlobalBKGDred;
|
|
|
|
pSave->iGlobalBKGDgreen = pData->iGlobalBKGDgreen;
|
|
|
|
pSave->iGlobalBKGDblue = pData->iGlobalBKGDblue;
|
|
|
|
|
|
|
|
/* freeze current image objects */
|
|
|
|
pImage = (mng_imagep)pData->pFirstimgobj;
|
|
|
|
|
|
|
|
while (pImage)
|
|
|
|
{ /* freeze the object AND it's buffer */
|
|
|
|
pImage->bFrozen = MNG_TRUE;
|
|
|
|
pImage->pImgbuf->bFrozen = MNG_TRUE;
|
|
|
|
/* neeeext */
|
|
|
|
pImage = (mng_imagep)pImage->sHeader.pNext;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_retcode mng_reset_objzero (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pObjzero;
|
|
|
|
mng_retcode iRetcode = reset_object_details (pData, pImage, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, MNG_TRUE);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
pImage->bVisible = MNG_TRUE;
|
|
|
|
pImage->bViewable = MNG_TRUE;
|
|
|
|
pImage->iPosx = 0;
|
|
|
|
pImage->iPosy = 0;
|
|
|
|
pImage->bClipped = MNG_FALSE;
|
|
|
|
pImage->iClipl = 0;
|
|
|
|
pImage->iClipr = 0;
|
|
|
|
pImage->iClipt = 0;
|
|
|
|
pImage->iClipb = 0;
|
|
|
|
pImage->iMAGN_MethodX = 0;
|
|
|
|
pImage->iMAGN_MethodY = 0;
|
|
|
|
pImage->iMAGN_MX = 0;
|
|
|
|
pImage->iMAGN_MY = 0;
|
|
|
|
pImage->iMAGN_ML = 0;
|
|
|
|
pImage->iMAGN_MR = 0;
|
|
|
|
pImage->iMAGN_MT = 0;
|
|
|
|
pImage->iMAGN_MB = 0;
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
mng_retcode restore_state (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_savedatap pSave;
|
|
|
|
mng_imagep pImage;
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_retcode iRetcode;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_START)
|
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
/* restore object 0 status !!! */
|
|
|
|
iRetcode = mng_reset_objzero (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2001-05-20 21:36:25 +04:00
|
|
|
/* fresh cycle; fake no frames done yet */
|
|
|
|
pData->bFramedone = MNG_FALSE;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
if (pData->pSavedata) /* do we have a saved state ? */
|
|
|
|
{
|
|
|
|
pSave = pData->pSavedata; /* address it more directly */
|
|
|
|
/* and copy it back to the main struct */
|
|
|
|
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
|
|
|
pData->bHasglobalPLTE = pSave->bHasglobalPLTE;
|
|
|
|
pData->bHasglobalTRNS = pSave->bHasglobalTRNS;
|
|
|
|
pData->bHasglobalGAMA = pSave->bHasglobalGAMA;
|
|
|
|
pData->bHasglobalCHRM = pSave->bHasglobalCHRM;
|
|
|
|
pData->bHasglobalSRGB = pSave->bHasglobalSRGB;
|
|
|
|
pData->bHasglobalICCP = pSave->bHasglobalICCP;
|
|
|
|
pData->bHasglobalBKGD = pSave->bHasglobalBKGD;
|
|
|
|
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
|
|
|
|
|
|
|
pData->iBACKred = pSave->iBACKred;
|
|
|
|
pData->iBACKgreen = pSave->iBACKgreen;
|
|
|
|
pData->iBACKblue = pSave->iBACKblue;
|
|
|
|
pData->iBACKmandatory = pSave->iBACKmandatory;
|
|
|
|
pData->iBACKimageid = pSave->iBACKimageid;
|
|
|
|
pData->iBACKtile = pSave->iBACKtile;
|
|
|
|
|
|
|
|
pData->iFRAMmode = pSave->iFRAMmode;
|
|
|
|
pData->iFRAMdelay = pSave->iFRAMdelay;
|
|
|
|
pData->iFRAMtimeout = pSave->iFRAMtimeout;
|
|
|
|
pData->bFRAMclipping = pSave->bFRAMclipping;
|
|
|
|
pData->iFRAMclipl = pSave->iFRAMclipl;
|
|
|
|
pData->iFRAMclipr = pSave->iFRAMclipr;
|
|
|
|
pData->iFRAMclipt = pSave->iFRAMclipt;
|
|
|
|
pData->iFRAMclipb = pSave->iFRAMclipb;
|
|
|
|
/* also the next subframe parms */
|
|
|
|
pData->iFramemode = pSave->iFRAMmode;
|
|
|
|
pData->iFramedelay = pSave->iFRAMdelay;
|
|
|
|
pData->iFrametimeout = pSave->iFRAMtimeout;
|
|
|
|
pData->bFrameclipping = pSave->bFRAMclipping;
|
|
|
|
pData->iFrameclipl = pSave->iFRAMclipl;
|
|
|
|
pData->iFrameclipr = pSave->iFRAMclipr;
|
|
|
|
pData->iFrameclipt = pSave->iFRAMclipt;
|
|
|
|
pData->iFrameclipb = pSave->iFRAMclipb;
|
|
|
|
|
|
|
|
pData->iNextdelay = pSave->iFRAMdelay;
|
|
|
|
|
|
|
|
pData->iGlobalPLTEcount = pSave->iGlobalPLTEcount;
|
2000-08-08 07:58:05 +04:00
|
|
|
MNG_COPY (pData->aGlobalPLTEentries, pSave->aGlobalPLTEentries, sizeof (mng_rgbpaltab))
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pData->iGlobalTRNSrawlen = pSave->iGlobalTRNSrawlen;
|
2000-08-08 07:58:05 +04:00
|
|
|
MNG_COPY (pData->aGlobalTRNSrawdata, pSave->aGlobalTRNSrawdata, 256)
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pData->iGlobalGamma = pSave->iGlobalGamma;
|
|
|
|
|
|
|
|
pData->iGlobalWhitepointx = pSave->iGlobalWhitepointx;
|
|
|
|
pData->iGlobalWhitepointy = pSave->iGlobalWhitepointy;
|
|
|
|
pData->iGlobalPrimaryredx = pSave->iGlobalPrimaryredx;
|
|
|
|
pData->iGlobalPrimaryredy = pSave->iGlobalPrimaryredy;
|
|
|
|
pData->iGlobalPrimarygreenx = pSave->iGlobalPrimarygreenx;
|
|
|
|
pData->iGlobalPrimarygreeny = pSave->iGlobalPrimarygreeny;
|
|
|
|
pData->iGlobalPrimarybluex = pSave->iGlobalPrimarybluex;
|
|
|
|
pData->iGlobalPrimarybluey = pSave->iGlobalPrimarybluey;
|
|
|
|
|
|
|
|
pData->iGlobalRendintent = pSave->iGlobalRendintent;
|
|
|
|
|
|
|
|
pData->iGlobalProfilesize = pSave->iGlobalProfilesize;
|
|
|
|
|
|
|
|
if (pData->iGlobalProfilesize) /* has a profile ? */
|
|
|
|
{ /* then copy that ! */
|
|
|
|
MNG_ALLOC (pData, pData->pGlobalProfile, pData->iGlobalProfilesize)
|
|
|
|
MNG_COPY (pData->pGlobalProfile, pSave->pGlobalProfile, pData->iGlobalProfilesize)
|
|
|
|
}
|
|
|
|
|
|
|
|
pData->iGlobalBKGDred = pSave->iGlobalBKGDred;
|
|
|
|
pData->iGlobalBKGDgreen = pSave->iGlobalBKGDgreen;
|
|
|
|
pData->iGlobalBKGDblue = pSave->iGlobalBKGDblue;
|
|
|
|
}
|
|
|
|
else /* no saved-data; so reset the lot */
|
|
|
|
{
|
|
|
|
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
|
|
|
pData->bHasglobalPLTE = MNG_FALSE;
|
|
|
|
pData->bHasglobalTRNS = MNG_FALSE;
|
|
|
|
pData->bHasglobalGAMA = MNG_FALSE;
|
|
|
|
pData->bHasglobalCHRM = MNG_FALSE;
|
|
|
|
pData->bHasglobalSRGB = MNG_FALSE;
|
|
|
|
pData->bHasglobalICCP = MNG_FALSE;
|
|
|
|
pData->bHasglobalBKGD = MNG_FALSE;
|
|
|
|
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
|
|
|
|
|
|
|
if (!pData->bEMNGMAhack) /* TODO: remove line in 1.0.0 !!! */
|
|
|
|
{ /* TODO: remove line in 1.0.0 !!! */
|
|
|
|
pData->iBACKred = 0;
|
|
|
|
pData->iBACKgreen = 0;
|
|
|
|
pData->iBACKblue = 0;
|
|
|
|
pData->iBACKmandatory = 0;
|
|
|
|
pData->iBACKimageid = 0;
|
|
|
|
pData->iBACKtile = 0;
|
|
|
|
} /* TODO: remove line in 1.0.0 !!! */
|
|
|
|
|
|
|
|
pData->iFRAMmode = 1;
|
|
|
|
pData->iFRAMdelay = 1;
|
|
|
|
pData->iFRAMtimeout = 0x7fffffffl;
|
|
|
|
pData->bFRAMclipping = MNG_FALSE;
|
|
|
|
pData->iFRAMclipl = 0;
|
|
|
|
pData->iFRAMclipr = 0;
|
|
|
|
pData->iFRAMclipt = 0;
|
|
|
|
pData->iFRAMclipb = 0;
|
|
|
|
/* also the next subframe parms */
|
|
|
|
pData->iFramemode = 1;
|
|
|
|
pData->iFramedelay = 1;
|
|
|
|
pData->iFrametimeout = 0x7fffffffl;
|
|
|
|
pData->bFrameclipping = MNG_FALSE;
|
|
|
|
pData->iFrameclipl = 0;
|
|
|
|
pData->iFrameclipr = 0;
|
|
|
|
pData->iFrameclipt = 0;
|
|
|
|
pData->iFrameclipb = 0;
|
|
|
|
|
|
|
|
pData->iNextdelay = 1;
|
|
|
|
|
|
|
|
pData->iGlobalPLTEcount = 0;
|
|
|
|
|
|
|
|
pData->iGlobalTRNSrawlen = 0;
|
|
|
|
|
|
|
|
pData->iGlobalGamma = 0;
|
|
|
|
|
|
|
|
pData->iGlobalWhitepointx = 0;
|
|
|
|
pData->iGlobalWhitepointy = 0;
|
|
|
|
pData->iGlobalPrimaryredx = 0;
|
|
|
|
pData->iGlobalPrimaryredy = 0;
|
|
|
|
pData->iGlobalPrimarygreenx = 0;
|
|
|
|
pData->iGlobalPrimarygreeny = 0;
|
|
|
|
pData->iGlobalPrimarybluex = 0;
|
|
|
|
pData->iGlobalPrimarybluey = 0;
|
|
|
|
|
|
|
|
pData->iGlobalRendintent = 0;
|
|
|
|
|
|
|
|
if (pData->iGlobalProfilesize) /* free a previous profile ? */
|
|
|
|
MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize)
|
|
|
|
|
|
|
|
pData->iGlobalProfilesize = 0;
|
|
|
|
|
|
|
|
pData->iGlobalBKGDred = 0;
|
|
|
|
pData->iGlobalBKGDgreen = 0;
|
|
|
|
pData->iGlobalBKGDblue = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bEMNGMAhack) /* TODO: remove line in 1.0.0 !!! */
|
|
|
|
{ /* TODO: remove line in 1.0.0 !!! */
|
|
|
|
/* drop un-frozen image objects */
|
|
|
|
pImage = (mng_imagep)pData->pFirstimgobj;
|
|
|
|
|
|
|
|
while (pImage)
|
|
|
|
{ /* is it un-frozen ? */
|
|
|
|
if (!pImage->bFrozen)
|
|
|
|
{
|
|
|
|
mng_imagep pPrev = (mng_imagep)pImage->sHeader.pPrev;
|
|
|
|
mng_imagep pNext = (mng_imagep)pImage->sHeader.pNext;
|
|
|
|
|
|
|
|
if (pPrev) /* unlink it */
|
|
|
|
pPrev->sHeader.pNext = pNext;
|
|
|
|
else
|
|
|
|
pData->pFirstimgobj = pNext;
|
|
|
|
|
|
|
|
if (pNext)
|
|
|
|
pNext->sHeader.pPrev = pPrev;
|
|
|
|
else
|
|
|
|
pData->pLastimgobj = pPrev;
|
|
|
|
|
|
|
|
if (pImage->pImgbuf->bFrozen) /* buffer frozen ? */
|
|
|
|
{
|
|
|
|
if (pImage->pImgbuf->iRefcount <= 2)
|
|
|
|
MNG_ERROR (pData, MNG_INTERNALERROR)
|
|
|
|
/* decrease ref counter */
|
|
|
|
pImage->pImgbuf->iRefcount--;
|
|
|
|
/* just cleanup the object then */
|
|
|
|
MNG_FREEX (pData, pImage, sizeof (mng_image))
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* free the image buffer */
|
|
|
|
iRetcode = free_imagedataobject (pData, pImage->pImgbuf);
|
|
|
|
/* and cleanup the object */
|
|
|
|
MNG_FREEX (pData, pImage, sizeof (mng_image))
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
pImage = pNext; /* this is the next */
|
|
|
|
}
|
|
|
|
else /* neeeext */
|
|
|
|
pImage = (mng_imagep)pImage->sHeader.pNext;
|
|
|
|
|
|
|
|
}
|
|
|
|
} /* TODO: remove line in 1.0.0 !!! */
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * * */
|
|
|
|
/* * General display processing routine * */
|
|
|
|
/* * * */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->iBreakpoint) /* not broken previously ? */
|
|
|
|
{
|
|
|
|
if ((pData->iRequestframe) || (pData->iRequestlayer) || (pData->iRequesttime))
|
|
|
|
{
|
|
|
|
pData->bSearching = MNG_TRUE; /* indicate we're searching */
|
|
|
|
|
|
|
|
iRetcode = clear_canvas (pData); /* make the canvas virgin black ?!? */
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
/* let's start from the top, shall we */
|
|
|
|
pData->pCurraniobj = pData->pFirstaniobj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
do /* process the objects */
|
|
|
|
{
|
|
|
|
if (pData->bSearching) /* are we looking sor something ? */
|
|
|
|
{
|
|
|
|
if ((pData->iRequestframe) &&
|
|
|
|
(pData->iRequestframe < ((mng_object_headerp)pData->pCurraniobj)->iFramenr))
|
|
|
|
{
|
|
|
|
pData->iRequestframe = 0; /* found the frame ! */
|
|
|
|
pData->bSearching = MNG_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iRequestlayer) &&
|
|
|
|
(pData->iRequestlayer < ((mng_object_headerp)pData->pCurraniobj)->iLayernr))
|
|
|
|
{
|
|
|
|
pData->iRequestlayer = 0; /* found the layer ! */
|
|
|
|
pData->bSearching = MNG_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iRequesttime) &&
|
|
|
|
(pData->iRequesttime < ((mng_object_headerp)pData->pCurraniobj)->iPlaytime))
|
|
|
|
{
|
|
|
|
pData->iRequesttime = 0; /* found the playtime ! */
|
|
|
|
pData->bSearching = MNG_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* do we need to finish something first ? */
|
|
|
|
if ((pData->iBreakpoint) && (pData->iBreakpoint < 99))
|
|
|
|
{
|
|
|
|
switch (pData->iBreakpoint) /* return to broken display routine */
|
|
|
|
{
|
|
|
|
case 1 : { iRetcode = process_display_fram2 (pData); break; }
|
|
|
|
case 3 : ; /* same as 4 !!! */
|
|
|
|
case 4 : { iRetcode = process_display_show (pData); break; }
|
|
|
|
case 5 : { iRetcode = process_display_clon2 (pData); break; }
|
2000-11-29 09:45:16 +03:00
|
|
|
case 9 : { iRetcode = process_display_magn2 (pData); break; }
|
2000-08-08 07:58:05 +04:00
|
|
|
default : MNG_ERROR (pData, MNG_INTERNALERROR)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pData->pCurraniobj)
|
|
|
|
iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bTimerset) /* reset breakpoint flag ? */
|
|
|
|
pData->iBreakpoint = 0;
|
|
|
|
/* can we advance to next object ? */
|
|
|
|
if ((!iRetcode) && (pData->pCurraniobj) &&
|
|
|
|
(!pData->bTimerset) && (!pData->bSectionwait))
|
|
|
|
{
|
|
|
|
pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext;
|
|
|
|
/* MEND processing to be done ? */
|
|
|
|
if ((pData->eImagetype == mng_it_mng) && (!pData->pCurraniobj))
|
|
|
|
iRetcode = process_display_mend (pData);
|
|
|
|
|
|
|
|
if (!pData->pCurraniobj) /* refresh after last image ? */
|
|
|
|
pData->bNeedrefresh = MNG_TRUE;
|
|
|
|
}
|
|
|
|
} /* until error or a break or no more objects */
|
|
|
|
while ((!iRetcode) && (pData->pCurraniobj) &&
|
|
|
|
(!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bFreezing));
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
/* refresh needed ? */
|
|
|
|
if ((!pData->bTimerset) && (pData->bNeedrefresh))
|
|
|
|
{
|
|
|
|
iRetcode = display_progressive_refresh (pData, 1);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
/* timer break ? */
|
|
|
|
if ((pData->bTimerset) && (!pData->iBreakpoint))
|
|
|
|
pData->iBreakpoint = 99;
|
|
|
|
else
|
|
|
|
if (!pData->bTimerset)
|
|
|
|
pData->iBreakpoint = 0; /* reset if no timer break */
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((!pData->bTimerset) && (!pData->pCurraniobj))
|
|
|
|
pData->bRunning = MNG_FALSE; /* all done now ! */
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * * */
|
|
|
|
/* * Chunk display processing routines * */
|
|
|
|
/* * * */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_ihdr (mng_datap pData)
|
|
|
|
{ /* address the current "object" if any */
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->bHasDHDR)
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
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->fDifferrow = MNG_NULL;
|
|
|
|
pData->pStoreobj = MNG_NULL;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->iBreakpoint) /* not previously broken ? */
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
if (pData->bHasDHDR) /* is a delta-image ? */
|
|
|
|
{
|
|
|
|
if (pData->iDeltatype == MNG_DELTATYPE_REPLACE)
|
|
|
|
iRetcode = reset_object_details (pData, (mng_imagep)pData->pDeltaImage,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iBitdepth, pData->iColortype,
|
|
|
|
pData->iCompression, pData->iFilter,
|
|
|
|
pData->iInterlace, MNG_TRUE);
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth;
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth;
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth;
|
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
/* process immediatly if bitdepth & colortype are equal */
|
|
|
|
pData->bDeltaimmediate =
|
|
|
|
(mng_bool)((pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&
|
|
|
|
(pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) );
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pImage) /* update object buffer ? */
|
|
|
|
iRetcode = reset_object_details (pData, pImage,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iBitdepth, pData->iColortype,
|
|
|
|
pData->iCompression, pData->iFilter,
|
|
|
|
pData->iInterlace, MNG_TRUE);
|
2000-08-08 07:58:05 +04:00
|
|
|
else
|
2000-06-13 03:06:35 +04:00
|
|
|
iRetcode = reset_object_details (pData, (mng_imagep)pData->pObjzero,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iBitdepth, pData->iColortype,
|
|
|
|
pData->iCompression, pData->iFilter,
|
|
|
|
pData->iInterlace, MNG_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bHasDHDR)
|
2000-08-08 07:58:05 +04:00
|
|
|
{
|
|
|
|
if (pImage) /* real object ? */
|
|
|
|
pData->pStoreobj = pImage; /* tell the row routines */
|
|
|
|
else /* otherwise use object 0 */
|
|
|
|
pData->pStoreobj = pData->pObjzero;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* display "on-the-fly" ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ( (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) &&
|
|
|
|
(((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) &&
|
2000-08-08 07:58:05 +04:00
|
|
|
( (pData->eImagetype == mng_it_png ) ||
|
2000-11-29 09:45:16 +03:00
|
|
|
(((mng_imagep)pData->pStoreobj)->bVisible) ) )
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
|
|
|
next_layer (pData); /* that's a new layer then ! */
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* timer break ? */
|
|
|
|
pData->iBreakpoint = 2;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pData->iBreakpoint = 0;
|
|
|
|
/* anything to display ? */
|
|
|
|
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
|
|
|
|
set_display_routine (pData); /* then determine display routine */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bTimerset) /* no timer break ? */
|
|
|
|
{
|
|
|
|
switch (pData->iColortype) /* determine row initialization routine */
|
|
|
|
{
|
|
|
|
case 0 : { /* gray */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g1_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g1_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g2_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g2_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g4_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g4_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : { /* rgb */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3 : { /* indexed */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx1_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx1_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx2_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx2_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx4_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx4_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : { /* gray+alpha */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6 : { /* rgb+alpha */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
pData->iFilterofs = 0; /* determine filter characteristics */
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->iLevel0 = 0; /* default levels */
|
|
|
|
pData->iLevel1 = 0;
|
|
|
|
pData->iLevel2 = 0;
|
|
|
|
pData->iLevel3 = 0;
|
|
|
|
/* leveling & differing ? */
|
|
|
|
/* if (pData->iFilter & 0x40)
|
2000-11-29 09:45:16 +03:00
|
|
|
{
|
|
|
|
switch (pData->iColortype)
|
|
|
|
{
|
|
|
|
case 0 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iFilterofs = 1;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 2;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iFilterofs = 3;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 6;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3 : {
|
|
|
|
pData->iFilterofs = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iFilterofs = 2;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 4;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iPixelofs = 5;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 8;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-01-30 04:04:13 +03:00
|
|
|
} */
|
|
|
|
/* no adaptive filtering ? */
|
|
|
|
/* if (pData->iFilter & 0x01)
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPixelofs = pData->iFilterofs;
|
2001-01-30 04:04:13 +03:00
|
|
|
else */
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPixelofs = pData->iFilterofs + 1;
|
|
|
|
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_idat (mng_datap pData,
|
|
|
|
mng_uint32 iRawlen,
|
|
|
|
mng_uint8p pRawdata)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bRestorebkgd) /* need to restore the background ? */
|
|
|
|
{
|
|
|
|
pData->bRestorebkgd = MNG_FALSE;
|
|
|
|
iRetcode = load_bkgdlayer (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
if ((pData->bDisplaying) && (pData->bRunning))
|
|
|
|
pData->iLayerseq++; /* and it counts as a layer then ! */
|
|
|
|
}
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
if (pData->fInitrowproc) /* need to initialize row processing? */
|
|
|
|
{
|
2000-06-13 03:06:35 +04:00
|
|
|
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
|
2001-05-20 21:36:25 +04:00
|
|
|
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
if ((!iRetcode) && (!pData->bInflating))
|
|
|
|
/* initialize inflate */
|
|
|
|
iRetcode = mngzlib_inflateinit (pData);
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
if (!iRetcode) /* all ok? then inflate, my man */
|
|
|
|
iRetcode = mngzlib_inflaterows (pData, iRawlen, pRawdata);
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
return MNG_NOERROR;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_iend (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode, iRetcode2;
|
|
|
|
mng_bool bDodisplay = MNG_FALSE;
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_bool bMagnify = MNG_FALSE;
|
2000-06-24 02:59:51 +04:00
|
|
|
mng_bool bCleanup = (mng_bool)(pData->iBreakpoint != 0);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MNG_INCLUDE_JNG /* progressive+alpha JNG can be displayed now */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ( (pData->bHasJHDR ) &&
|
|
|
|
( (pData->bJPEGprogressive) || (pData->bJPEGprogressive2)) &&
|
|
|
|
( (pData->eImagetype == mng_it_jng ) ||
|
|
|
|
(((mng_imagep)pData->pStoreobj)->bVisible) ) &&
|
|
|
|
( (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) ||
|
|
|
|
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) )
|
2000-06-13 03:06:35 +04:00
|
|
|
bDodisplay = MNG_TRUE;
|
2000-11-29 09:45:16 +03:00
|
|
|
#endif
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if ( (pData->pStoreobj) && /* on-the-fly magnification ? */
|
|
|
|
( (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX) ||
|
|
|
|
(((mng_imagep)pData->pStoreobj)->iMAGN_MethodY) ) )
|
|
|
|
bMagnify = MNG_TRUE;
|
|
|
|
|
|
|
|
if ((pData->bHasBASI) || /* was it a BASI stream */
|
|
|
|
(bDodisplay) || /* or should we display the JNG */
|
|
|
|
(bMagnify) || /* or should we magnify it */
|
2000-08-08 07:58:05 +04:00
|
|
|
/* or did we get broken here last time ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
((pData->iBreakpoint) && (pData->iBreakpoint != 8)))
|
|
|
|
{
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!pImage) /* or was it object 0 ? */
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* display it now then ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((pImage->bVisible) && (pImage->bViewable))
|
|
|
|
{ /* ok, so do it */
|
|
|
|
iRetcode = display_image (pData, pImage, bDodisplay);
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bTimerset) /* timer break ? */
|
|
|
|
pData->iBreakpoint = 6;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->bHasDHDR) || /* was it a DHDR stream */
|
|
|
|
(pData->iBreakpoint == 8)) /* or did we get broken here last time ? */
|
|
|
|
{
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pDeltaImage;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (!pData->iBreakpoint)
|
|
|
|
{ /* perform the delta operations needed */
|
2000-08-08 07:58:05 +04:00
|
|
|
iRetcode = execute_delta_image (pData, pImage, (mng_imagep)pData->pObjzero);
|
2000-06-24 02:59:51 +04:00
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
2000-08-08 07:58:05 +04:00
|
|
|
/* display it now then ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((pImage->bVisible) && (pImage->bViewable))
|
|
|
|
{ /* ok, so do it */
|
|
|
|
iRetcode = display_image (pData, pImage, MNG_FALSE);
|
2000-06-24 02:59:51 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2000-08-08 07:58:05 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bTimerset) /* timer break ? */
|
|
|
|
pData->iBreakpoint = 8;
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
if (!pData->bTimerset) /* can we continue ? */
|
|
|
|
{
|
|
|
|
pData->iBreakpoint = 0; /* clear this flag now ! */
|
|
|
|
/* cleanup object 0 */
|
|
|
|
reset_object_details (pData, (mng_imagep)pData->pObjzero,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, MNG_TRUE);
|
|
|
|
|
|
|
|
if (pData->bInflating) /* if we've been inflating */
|
|
|
|
{ /* cleanup row-processing, */
|
|
|
|
iRetcode = cleanup_rowproc (pData);
|
|
|
|
/* also cleanup inflate! */
|
|
|
|
iRetcode2 = mngzlib_inflatefree (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
if (iRetcode2)
|
|
|
|
return iRetcode2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_INCLUDE_JNG
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bJPEGdecompress) /* if we've been decompressing JDAT */
|
2000-06-13 03:06:35 +04:00
|
|
|
{ /* cleanup row-processing, */
|
|
|
|
iRetcode = cleanup_rowproc (pData);
|
|
|
|
/* also cleanup decompress! */
|
|
|
|
iRetcode2 = mngjpeg_decompressfree (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
if (iRetcode2)
|
|
|
|
return iRetcode2;
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
if (pData->bJPEGdecompress2) /* if we've been decompressing JDAA */
|
|
|
|
{ /* cleanup row-processing, */
|
|
|
|
iRetcode = cleanup_rowproc (pData);
|
|
|
|
/* also cleanup decompress! */
|
|
|
|
iRetcode2 = mngjpeg_decompressfree2 (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
if (iRetcode2)
|
|
|
|
return iRetcode2;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
#endif
|
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
if (bCleanup) /* if we got broken last time we need to cleanup */
|
|
|
|
{
|
|
|
|
pData->bHasIHDR = MNG_FALSE; /* IEND signals the end for most ... */
|
|
|
|
pData->bHasBASI = MNG_FALSE;
|
|
|
|
pData->bHasDHDR = MNG_FALSE;
|
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
pData->bHasJHDR = MNG_FALSE;
|
|
|
|
pData->bHasJSEP = MNG_FALSE;
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->bHasJDAA = MNG_FALSE;
|
2000-06-24 02:59:51 +04:00
|
|
|
pData->bHasJDAT = MNG_FALSE;
|
|
|
|
#endif
|
|
|
|
pData->bHasPLTE = MNG_FALSE;
|
|
|
|
pData->bHasTRNS = MNG_FALSE;
|
|
|
|
pData->bHasGAMA = MNG_FALSE;
|
|
|
|
pData->bHasCHRM = MNG_FALSE;
|
|
|
|
pData->bHasSRGB = MNG_FALSE;
|
|
|
|
pData->bHasICCP = MNG_FALSE;
|
|
|
|
pData->bHasBKGD = MNG_FALSE;
|
|
|
|
pData->bHasIDAT = MNG_FALSE;
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
/* if the image was displayed on the fly, */
|
|
|
|
/* we'll have to make the app refresh */
|
|
|
|
if ((pData->eImagetype != mng_it_mng) && (pData->fDisplayrow))
|
|
|
|
pData->bNeedrefresh = MNG_TRUE;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_mend (mng_datap pData)
|
|
|
|
{
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START)
|
|
|
|
#endif
|
2000-11-29 09:45:16 +03:00
|
|
|
/* TERM processed ? */
|
2001-11-01 03:19:53 +03:00
|
|
|
if ((pData->bDisplaying) && (pData->bRunning) &&
|
|
|
|
(pData->bHasTERM) && (pData->pTermaniobj))
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
|
|
|
mng_retcode iRetcode;
|
|
|
|
mng_ani_termp pTERM;
|
|
|
|
/* get the right animation object ! */
|
|
|
|
pTERM = (mng_ani_termp)pData->pTermaniobj;
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
pData->iIterations++; /* increase iteration count */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
switch (pTERM->iTermaction) /* determine what to do! */
|
|
|
|
{
|
|
|
|
case 0 : { /* show last frame indefinitly */
|
|
|
|
break; /* piece of cake, that is... */
|
|
|
|
}
|
|
|
|
|
|
|
|
case 1 : { /* cease displaying anything */
|
|
|
|
pData->bFrameclipping = MNG_FALSE;
|
|
|
|
load_bkgdlayer (pData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2 : { /* show first image after TERM */
|
|
|
|
|
|
|
|
/* TODO: something */
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3 : { /* repeat */
|
|
|
|
if ((pTERM->iItermax) && (pTERM->iItermax < 0x7FFFFFFF))
|
|
|
|
pTERM->iItermax--;
|
|
|
|
|
|
|
|
if (pTERM->iItermax) /* go back to TERM ? */
|
|
|
|
{ /* restore to initial or SAVE state */
|
|
|
|
iRetcode = restore_state (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
2001-05-20 21:36:25 +04:00
|
|
|
/* notify the app ? */
|
|
|
|
if (pData->fProcessmend)
|
|
|
|
{
|
|
|
|
mng_bool bOke = pData->fProcessmend ((mng_handle)pData,
|
|
|
|
pData->iIterations,
|
|
|
|
pTERM->iItermax);
|
|
|
|
if (!bOke) /* stop here and now ? */
|
|
|
|
break;
|
|
|
|
}
|
2000-08-08 07:58:05 +04:00
|
|
|
/* restart from TERM chunk */
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->pCurraniobj = pTERM;
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
if (pTERM->iDelay) /* set the delay (?) */
|
|
|
|
{
|
|
|
|
mng_uint32 iWaitfor = 1000;
|
|
|
|
/* what are we aiming for */
|
|
|
|
if (pData->iTicks)
|
|
|
|
{ /* honor speed modifier */
|
|
|
|
switch (pData->iSpeed)
|
|
|
|
{
|
|
|
|
case mng_st_fast :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)(( 500 * pTERM->iDelay) / pData->iTicks);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mng_st_slow :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)((3000 * pTERM->iDelay) / pData->iTicks);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mng_st_slowest :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)((8000 * pTERM->iDelay) / pData->iTicks);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default :
|
|
|
|
{
|
|
|
|
iWaitfor = (mng_uint32)((1000 * pTERM->iDelay) / pData->iTicks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
iRetcode = display_progressive_refresh (pData, iWaitfor);
|
2000-08-08 07:58:05 +04:00
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (pTERM->iIteraction)
|
|
|
|
{
|
|
|
|
case 0 : { /* show last frame indefinitly */
|
|
|
|
break; /* piece of cake, that is... */
|
|
|
|
}
|
|
|
|
|
|
|
|
case 1 : { /* cease displaying anything */
|
|
|
|
pData->bFrameclipping = MNG_FALSE;
|
|
|
|
load_bkgdlayer (pData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2 : { /* show first image after TERM */
|
|
|
|
|
|
|
|
/* TODO: something */
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->pCurraniobj) /* always let the app refresh at the end ! */
|
2000-06-24 02:59:51 +04:00
|
|
|
pData->bNeedrefresh = MNG_TRUE;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_defi (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->iDEFIobjectid) /* object id=0 ? */
|
|
|
|
{
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
if (pData->bDEFIhasdonotshow)
|
|
|
|
pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0);
|
|
|
|
|
|
|
|
if (pData->bDEFIhasloca)
|
|
|
|
{
|
|
|
|
pImage->iPosx = pData->iDEFIlocax;
|
|
|
|
pImage->iPosy = pData->iDEFIlocay;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
if (pData->bDEFIhasclip)
|
|
|
|
{
|
|
|
|
pImage->bClipped = pData->bDEFIhasclip;
|
|
|
|
pImage->iClipl = pData->iDEFIclipl;
|
|
|
|
pImage->iClipr = pData->iDEFIclipr;
|
|
|
|
pImage->iClipt = pData->iDEFIclipt;
|
|
|
|
pImage->iClipb = pData->iDEFIclipb;
|
|
|
|
}
|
|
|
|
|
|
|
|
pData->pCurrentobj = 0; /* not a real object ! */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* already exists ? */
|
|
|
|
pImage = (mng_imagep)find_imageobject (pData, pData->iDEFIobjectid);
|
|
|
|
|
|
|
|
if (!pImage) /* if not; create new */
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = create_imageobject (pData, pData->iDEFIobjectid,
|
|
|
|
(mng_bool)(pData->iDEFIconcrete == 1),
|
|
|
|
(mng_bool)(pData->iDEFIdonotshow == 0),
|
|
|
|
MNG_FALSE, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
pData->iDEFIlocax, pData->iDEFIlocay,
|
|
|
|
pData->bDEFIhasclip,
|
|
|
|
pData->iDEFIclipl, pData->iDEFIclipr,
|
|
|
|
pData->iDEFIclipt, pData->iDEFIclipb,
|
|
|
|
&pImage);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* exists; then set new info */
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bDEFIhasdonotshow)
|
|
|
|
pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0);
|
|
|
|
|
|
|
|
pImage->bViewable = MNG_FALSE;
|
|
|
|
|
|
|
|
if (pData->bDEFIhasloca)
|
|
|
|
{
|
|
|
|
pImage->iPosx = pData->iDEFIlocax;
|
|
|
|
pImage->iPosy = pData->iDEFIlocay;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->bDEFIhasclip)
|
|
|
|
{
|
|
|
|
pImage->bClipped = pData->bDEFIhasclip;
|
|
|
|
pImage->iClipl = pData->iDEFIclipl;
|
|
|
|
pImage->iClipr = pData->iDEFIclipr;
|
|
|
|
pImage->iClipt = pData->iDEFIclipt;
|
|
|
|
pImage->iClipb = pData->iDEFIclipb;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bDEFIhasconcrete)
|
|
|
|
pImage->pImgbuf->bConcrete = (mng_bool)(pData->iDEFIconcrete == 1);
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
pData->pCurrentobj = pImage; /* others may want to know this */
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_basi (mng_datap pData,
|
|
|
|
mng_uint16 iRed,
|
|
|
|
mng_uint16 iGreen,
|
|
|
|
mng_uint16 iBlue,
|
|
|
|
mng_bool bHasalpha,
|
|
|
|
mng_uint16 iAlpha,
|
|
|
|
mng_uint8 iViewable)
|
|
|
|
{ /* address the current "object" if any */
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
|
|
|
mng_uint8p pWork;
|
|
|
|
mng_uint32 iX;
|
2000-06-14 18:20:55 +04:00
|
|
|
mng_imagedatap pBuf;
|
2000-06-13 03:06:35 +04:00
|
|
|
mng_retcode iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pImage) /* or is it an "on-the-fly" image ? */
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
2000-06-14 18:20:55 +04:00
|
|
|
/* address the object-buffer */
|
|
|
|
pBuf = pImage->pImgbuf;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fDisplayrow = MNG_NULL; /* do nothing by default */
|
|
|
|
pData->fCorrectrow = MNG_NULL;
|
|
|
|
pData->fStorerow = MNG_NULL;
|
|
|
|
pData->fProcessrow = MNG_NULL;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* set parms now that they're known */
|
|
|
|
iRetcode = reset_object_details (pData, pImage, pData->iDatawidth,
|
|
|
|
pData->iDataheight, pData->iBitdepth,
|
|
|
|
pData->iColortype, pData->iCompression,
|
|
|
|
pData->iFilter, pData->iInterlace, MNG_FALSE);
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
/* save the viewable flag */
|
|
|
|
pImage->bViewable = (mng_bool)(iViewable == 1);
|
2000-06-14 18:20:55 +04:00
|
|
|
pBuf->bViewable = pImage->bViewable;
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->pStoreobj = pImage; /* let row-routines know which object */
|
|
|
|
|
|
|
|
pWork = pBuf->pImgdata; /* fill the object-buffer with the specified
|
|
|
|
"color" sample */
|
|
|
|
switch (pData->iColortype) /* depending on color_type & bit_depth */
|
|
|
|
{
|
|
|
|
case 0 : { /* gray */
|
|
|
|
if (pData->iBitdepth == 16)
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
mng_put_uint16 (pWork, iRed);
|
|
|
|
pWork += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
*pWork = (mng_uint8)iRed;
|
|
|
|
pWork++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* force tRNS ? */
|
|
|
|
if ((bHasalpha) && (!iAlpha))
|
|
|
|
{
|
|
|
|
pBuf->bHasTRNS = MNG_TRUE;
|
|
|
|
pBuf->iTRNSgray = iRed;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2 : { /* rgb */
|
|
|
|
if (pData->iBitdepth == 16)
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
mng_put_uint16 (pWork, iRed );
|
|
|
|
mng_put_uint16 (pWork+2, iGreen);
|
|
|
|
mng_put_uint16 (pWork+4, iBlue );
|
|
|
|
pWork += 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
*pWork = (mng_uint8)iRed;
|
|
|
|
*(pWork+1) = (mng_uint8)iGreen;
|
|
|
|
*(pWork+2) = (mng_uint8)iBlue;
|
|
|
|
pWork += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* force tRNS ? */
|
|
|
|
if ((bHasalpha) && (!iAlpha))
|
|
|
|
{
|
|
|
|
pBuf->bHasTRNS = MNG_TRUE;
|
|
|
|
pBuf->iTRNSred = iRed;
|
|
|
|
pBuf->iTRNSgreen = iGreen;
|
|
|
|
pBuf->iTRNSblue = iBlue;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3 : { /* indexed */
|
2000-06-14 18:20:55 +04:00
|
|
|
pBuf->bHasPLTE = MNG_TRUE;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : { pBuf->iPLTEcount = 2; break; }
|
|
|
|
case 2 : { pBuf->iPLTEcount = 4; break; }
|
|
|
|
case 4 : { pBuf->iPLTEcount = 16; break; }
|
|
|
|
case 8 : { pBuf->iPLTEcount = 256; break; }
|
|
|
|
default : { pBuf->iPLTEcount = 1; break; }
|
|
|
|
}
|
|
|
|
|
|
|
|
pBuf->aPLTEentries [0].iRed = (mng_uint8)iRed;
|
|
|
|
pBuf->aPLTEentries [0].iGreen = (mng_uint8)iGreen;
|
|
|
|
pBuf->aPLTEentries [0].iBlue = (mng_uint8)iBlue;
|
|
|
|
|
|
|
|
for (iX = 1; iX < pBuf->iPLTEcount; iX++)
|
|
|
|
{
|
|
|
|
pBuf->aPLTEentries [iX].iRed = 0;
|
|
|
|
pBuf->aPLTEentries [iX].iGreen = 0;
|
|
|
|
pBuf->aPLTEentries [iX].iBlue = 0;
|
|
|
|
}
|
|
|
|
/* force tRNS ? */
|
|
|
|
if ((bHasalpha) && (iAlpha < 255))
|
|
|
|
{
|
|
|
|
pBuf->bHasTRNS = MNG_TRUE;
|
|
|
|
pBuf->iTRNScount = 1;
|
|
|
|
pBuf->aTRNSentries [0] = (mng_uint8)iAlpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 4 : { /* gray+alpha */
|
|
|
|
if (pData->iBitdepth == 16)
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
mng_put_uint16 (pWork, iRed);
|
|
|
|
mng_put_uint16 (pWork+2, iAlpha);
|
|
|
|
pWork += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
*pWork = (mng_uint8)iRed;
|
|
|
|
*(pWork+1) = (mng_uint8)iAlpha;
|
|
|
|
pWork += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 6 : { /* rgb+alpha */
|
|
|
|
if (pData->iBitdepth == 16)
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
mng_put_uint16 (pWork, iRed);
|
|
|
|
mng_put_uint16 (pWork+2, iGreen);
|
|
|
|
mng_put_uint16 (pWork+4, iBlue);
|
|
|
|
mng_put_uint16 (pWork+6, iAlpha);
|
|
|
|
pWork += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++)
|
|
|
|
{
|
|
|
|
*pWork = (mng_uint8)iRed;
|
|
|
|
*(pWork+1) = (mng_uint8)iGreen;
|
|
|
|
*(pWork+2) = (mng_uint8)iBlue;
|
|
|
|
*(pWork+3) = (mng_uint8)iAlpha;
|
|
|
|
pWork += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (pData->iColortype) /* determine row initialization routine */
|
|
|
|
{ /* just to accomodate IDAT if it arrives */
|
|
|
|
case 0 : { /* gray */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g1_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g1_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g2_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g2_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g4_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g4_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : { /* rgb */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3 : { /* indexed */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx1_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx1_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx2_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx2_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx4_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx4_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : { /* gray+alpha */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6 : { /* rgb+alpha */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iFilterofs = 0; /* determine filter characteristics */
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->iLevel0 = 0; /* default levels */
|
|
|
|
pData->iLevel1 = 0;
|
|
|
|
pData->iLevel2 = 0;
|
|
|
|
pData->iLevel3 = 0;
|
|
|
|
/* leveling & differing ? */
|
|
|
|
/* if (pData->iFilter & 0x40)
|
2000-11-29 09:45:16 +03:00
|
|
|
{
|
|
|
|
switch (pData->iColortype)
|
|
|
|
{
|
|
|
|
case 0 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iFilterofs = 1;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 2;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iFilterofs = 3;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 6;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3 : {
|
|
|
|
pData->iFilterofs = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iFilterofs = 2;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 4;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6 : {
|
|
|
|
if (pData->iBitdepth <= 8)
|
|
|
|
pData->iPixelofs = 5;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 8;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-01-30 04:04:13 +03:00
|
|
|
} */
|
|
|
|
/* no adaptive filtering ? */
|
|
|
|
/* if (pData->iFilter & 0x01)
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPixelofs = pData->iFilterofs;
|
2001-01-30 04:04:13 +03:00
|
|
|
else */
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPixelofs = pData->iFilterofs + 1;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_clon (mng_datap pData,
|
|
|
|
mng_uint16 iSourceid,
|
|
|
|
mng_uint16 iCloneid,
|
|
|
|
mng_uint8 iClonetype,
|
|
|
|
mng_bool bHasdonotshow,
|
|
|
|
mng_uint8 iDonotshow,
|
|
|
|
mng_uint8 iConcrete,
|
|
|
|
mng_bool bHasloca,
|
|
|
|
mng_uint8 iLocationtype,
|
|
|
|
mng_int32 iLocationx,
|
|
|
|
mng_int32 iLocationy)
|
|
|
|
{
|
|
|
|
mng_imagep pSource, pClone;
|
|
|
|
mng_bool bVisible, bAbstract;
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* locate the source object first */
|
|
|
|
pSource = find_imageobject (pData, iSourceid);
|
|
|
|
/* check if the clone exists */
|
|
|
|
pClone = find_imageobject (pData, iCloneid);
|
|
|
|
|
|
|
|
if (!pSource) /* source must exist ! */
|
|
|
|
MNG_ERROR (pData, MNG_OBJECTUNKNOWN);
|
|
|
|
|
|
|
|
if (pClone) /* clone must not exist ! */
|
|
|
|
MNG_ERROR (pData, MNG_OBJECTEXISTS);
|
|
|
|
|
|
|
|
if (bHasdonotshow) /* DoNotShow flag filled ? */
|
|
|
|
bVisible = (mng_bool)(iDonotshow == 0);
|
|
|
|
else
|
|
|
|
bVisible = pSource->bVisible;
|
|
|
|
|
|
|
|
bAbstract = (mng_bool)(iConcrete == 1);
|
|
|
|
|
|
|
|
switch (iClonetype) /* determine action to take */
|
|
|
|
{
|
|
|
|
case 0 : { /* full clone */
|
|
|
|
iRetcode = clone_imageobject (pData, iCloneid, MNG_FALSE,
|
|
|
|
bVisible, bAbstract, bHasloca,
|
|
|
|
iLocationtype, iLocationx, iLocationy,
|
|
|
|
pSource, &pClone);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 1 : { /* partial clone */
|
|
|
|
iRetcode = clone_imageobject (pData, iCloneid, MNG_TRUE,
|
|
|
|
bVisible, bAbstract, bHasloca,
|
|
|
|
iLocationtype, iLocationx, iLocationy,
|
|
|
|
pSource, &pClone);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2 : { /* renumber object */
|
|
|
|
iRetcode = renum_imageobject (pData, pSource, iCloneid,
|
|
|
|
bVisible, bAbstract, bHasloca,
|
|
|
|
iLocationtype, iLocationx, iLocationy);
|
|
|
|
pClone = pSource;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
/* display on the fly ? */
|
|
|
|
if ((pClone->bViewable) && (pClone->bVisible))
|
|
|
|
{
|
|
|
|
pData->pLastclone = pClone; /* remember in case of timer break ! */
|
|
|
|
/* display it */
|
|
|
|
display_image (pData, pClone, MNG_FALSE);
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* timer break ? */
|
|
|
|
pData->iBreakpoint = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_clon2 (mng_datap pData)
|
|
|
|
{
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* only called after timer break ! */
|
|
|
|
display_image (pData, (mng_imagep)pData->pLastclone, MNG_FALSE);
|
|
|
|
pData->iBreakpoint = 0;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_disc (mng_datap pData,
|
|
|
|
mng_uint32 iCount,
|
|
|
|
mng_uint16p pIds)
|
|
|
|
{
|
|
|
|
mng_uint32 iX;
|
|
|
|
mng_imagep pImage;
|
|
|
|
mng_uint32 iRetcode;
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (iCount) /* specific list ? */
|
|
|
|
{
|
|
|
|
mng_uint16p pWork = pIds;
|
|
|
|
|
|
|
|
for (iX = 0; iX < iCount; iX++) /* iterate the list */
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, *pWork++);
|
|
|
|
|
|
|
|
if (pImage) /* found the object ? */
|
|
|
|
{ /* then drop it */
|
|
|
|
iRetcode = free_imageobject (pData, pImage);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* empty: drop all un-frozen objects */
|
|
|
|
{
|
|
|
|
mng_imagep pNext = (mng_imagep)pData->pFirstimgobj;
|
|
|
|
|
|
|
|
while (pNext) /* any left ? */
|
|
|
|
{
|
|
|
|
pImage = pNext;
|
|
|
|
pNext = pImage->sHeader.pNext;
|
|
|
|
|
|
|
|
if (!pImage->bFrozen) /* not frozen ? */
|
|
|
|
{ /* then drop it */
|
|
|
|
iRetcode = free_imageobject (pData, pImage);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_fram (mng_datap pData,
|
|
|
|
mng_uint8 iFramemode,
|
|
|
|
mng_uint8 iChangedelay,
|
|
|
|
mng_uint32 iDelay,
|
|
|
|
mng_uint8 iChangetimeout,
|
|
|
|
mng_uint32 iTimeout,
|
|
|
|
mng_uint8 iChangeclipping,
|
|
|
|
mng_uint8 iCliptype,
|
|
|
|
mng_int32 iClipl,
|
|
|
|
mng_int32 iClipr,
|
|
|
|
mng_int32 iClipt,
|
|
|
|
mng_int32 iClipb)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
mng_retcode iRetcode;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* advance a frame then */
|
|
|
|
iRetcode = next_frame (pData, iFramemode, iChangedelay, iDelay,
|
|
|
|
iChangetimeout, iTimeout, iChangeclipping,
|
|
|
|
iCliptype, iClipl, iClipr, iClipt, iClipb);
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* timer break ? */
|
|
|
|
pData->iBreakpoint = 1;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_fram2 (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* again; after the break */
|
|
|
|
iRetcode = next_frame (pData, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
|
|
pData->iBreakpoint = 0; /* not again! */
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_move (mng_datap pData,
|
|
|
|
mng_uint16 iFromid,
|
|
|
|
mng_uint16 iToid,
|
|
|
|
mng_uint8 iMovetype,
|
|
|
|
mng_int32 iMovex,
|
|
|
|
mng_int32 iMovey)
|
|
|
|
{
|
|
|
|
mng_uint16 iX;
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* iterate the list */
|
|
|
|
for (iX = iFromid; iX <= iToid; iX++)
|
|
|
|
{
|
|
|
|
if (!iX) /* object id=0 ? */
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
|
|
|
else
|
|
|
|
pImage = find_imageobject (pData, iX);
|
|
|
|
|
|
|
|
if (pImage) /* object exists ? */
|
|
|
|
{
|
|
|
|
switch (iMovetype)
|
|
|
|
{
|
|
|
|
case 0 : { /* absolute */
|
|
|
|
pImage->iPosx = iMovex;
|
|
|
|
pImage->iPosy = iMovey;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1 : { /* relative */
|
|
|
|
pImage->iPosx = pImage->iPosx + iMovex;
|
|
|
|
pImage->iPosy = pImage->iPosy + iMovey;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_clip (mng_datap pData,
|
|
|
|
mng_uint16 iFromid,
|
|
|
|
mng_uint16 iToid,
|
|
|
|
mng_uint8 iCliptype,
|
|
|
|
mng_int32 iClipl,
|
|
|
|
mng_int32 iClipr,
|
|
|
|
mng_int32 iClipt,
|
|
|
|
mng_int32 iClipb)
|
|
|
|
{
|
|
|
|
mng_uint16 iX;
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* iterate the list */
|
|
|
|
for (iX = iFromid; iX <= iToid; iX++)
|
|
|
|
{
|
|
|
|
if (!iX) /* object id=0 ? */
|
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
|
|
|
else
|
|
|
|
pImage = find_imageobject (pData, iX);
|
|
|
|
|
|
|
|
if (pImage) /* object exists ? */
|
|
|
|
{
|
|
|
|
switch (iCliptype)
|
|
|
|
{
|
|
|
|
case 0 : { /* absolute */
|
|
|
|
pImage->bClipped = MNG_TRUE;
|
|
|
|
pImage->iClipl = iClipl;
|
|
|
|
pImage->iClipr = iClipr;
|
|
|
|
pImage->iClipt = iClipt;
|
|
|
|
pImage->iClipb = iClipb;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1 : { /* relative */
|
|
|
|
pImage->bClipped = MNG_TRUE;
|
|
|
|
pImage->iClipl = pImage->iClipl + iClipl;
|
|
|
|
pImage->iClipr = pImage->iClipr + iClipr;
|
|
|
|
pImage->iClipt = pImage->iClipt + iClipt;
|
|
|
|
pImage->iClipb = pImage->iClipb + iClipb;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_show (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_int16 iX, iS, iFrom, iTo;
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* TODO: optimization for the cases where "abs (iTo - iFrom)" is rather high;
|
|
|
|
especially where ((iFrom==1) && (iTo==65535)); eg. an empty SHOW !!! */
|
|
|
|
|
|
|
|
if (pData->iBreakpoint == 3) /* previously broken during cycle-mode ? */
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, pData->iSHOWnextid);
|
|
|
|
|
|
|
|
if (pImage) /* still there ? */
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
|
|
|
|
pData->iBreakpoint = 0; /* let's not go through this again! */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pData->iBreakpoint) /* previously broken at other point ? */
|
|
|
|
{ /* restore last parms */
|
|
|
|
iFrom = (mng_int16)pData->iSHOWfromid;
|
|
|
|
iTo = (mng_int16)pData->iSHOWtoid;
|
|
|
|
iX = (mng_int16)pData->iSHOWnextid;
|
|
|
|
iS = (mng_int16)pData->iSHOWskip;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* regular sequence ? */
|
|
|
|
if (pData->iSHOWtoid >= pData->iSHOWfromid)
|
|
|
|
iS = 1;
|
|
|
|
else /* reverse sequence ! */
|
|
|
|
iS = -1;
|
|
|
|
|
|
|
|
iFrom = (mng_int16)pData->iSHOWfromid;
|
|
|
|
iTo = (mng_int16)pData->iSHOWtoid;
|
|
|
|
iX = iFrom;
|
2000-11-29 09:45:16 +03:00
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->iSHOWfromid = (mng_uint16)iFrom;
|
|
|
|
pData->iSHOWtoid = (mng_uint16)iTo;
|
|
|
|
pData->iSHOWskip = iS;
|
|
|
|
}
|
|
|
|
/* cycle mode ? */
|
|
|
|
if ((pData->iSHOWmode == 6) || (pData->iSHOWmode == 7))
|
|
|
|
{
|
|
|
|
mng_uint16 iTrigger = 0;
|
|
|
|
mng_uint16 iFound = 0;
|
|
|
|
mng_uint16 iPass = 0;
|
|
|
|
mng_imagep pFound = 0;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
iPass++; /* lets prevent endless loops when there
|
|
|
|
are no potential candidates in the list! */
|
|
|
|
|
|
|
|
if (iS > 0) /* forward ? */
|
|
|
|
{
|
|
|
|
for (iX = iFrom; iX <= iTo; iX += iS)
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, (mng_uint16)iX);
|
|
|
|
|
|
|
|
if (pImage) /* object exists ? */
|
|
|
|
{
|
|
|
|
if (iFound) /* already found a candidate ? */
|
|
|
|
pImage->bVisible = MNG_FALSE;
|
|
|
|
else
|
|
|
|
if (iTrigger) /* found the trigger ? */
|
|
|
|
{
|
|
|
|
pImage->bVisible = MNG_TRUE;
|
|
|
|
iFound = iX;
|
|
|
|
pFound = pImage;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (pImage->bVisible) /* ok, this is the trigger */
|
|
|
|
{
|
|
|
|
pImage->bVisible = MNG_FALSE;
|
|
|
|
iTrigger = iX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (iX = iFrom; iX >= iTo; iX += iS)
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, (mng_uint16)iX);
|
|
|
|
|
|
|
|
if (pImage) /* object exists ? */
|
|
|
|
{
|
|
|
|
if (iFound) /* already found a candidate ? */
|
|
|
|
pImage->bVisible = MNG_FALSE;
|
|
|
|
else
|
|
|
|
if (iTrigger) /* found the trigger ? */
|
|
|
|
{
|
|
|
|
pImage->bVisible = MNG_TRUE;
|
|
|
|
iFound = iX;
|
|
|
|
pFound = pImage;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (pImage->bVisible) /* ok, this is the trigger */
|
|
|
|
{
|
|
|
|
pImage->bVisible = MNG_FALSE;
|
|
|
|
iTrigger = iX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!iTrigger) /* did not find a trigger ? */
|
|
|
|
iTrigger = 1; /* then fake it so the first image
|
|
|
|
gets nominated */
|
|
|
|
} /* cycle back to beginning ? */
|
|
|
|
while ((iPass < 2) && (iTrigger) && (!iFound));
|
|
|
|
|
|
|
|
pData->iBreakpoint = 0; /* just a sanity precaution */
|
|
|
|
/* display it ? */
|
|
|
|
if ((pData->iSHOWmode == 6) && (pFound))
|
|
|
|
{
|
|
|
|
display_image (pData, pFound, MNG_FALSE);
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* timer set ? */
|
|
|
|
{
|
|
|
|
pData->iBreakpoint = 3;
|
|
|
|
pData->iSHOWnextid = iFound; /* save it for after the break */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, iX);
|
|
|
|
|
|
|
|
if (pImage) /* object exists ? */
|
|
|
|
{
|
|
|
|
if (pData->iBreakpoint) /* did we get broken last time ? */
|
|
|
|
{ /* could only happen in the display routine */
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
pData->iBreakpoint = 0; /* only once inside this loop please ! */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (pData->iSHOWmode) /* do what ? */
|
|
|
|
{
|
|
|
|
case 0 : {
|
|
|
|
pImage->bVisible = MNG_TRUE;
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1 : {
|
|
|
|
pImage->bVisible = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (pImage->bVisible)
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3 : {
|
|
|
|
pImage->bVisible = MNG_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
pImage->bVisible = (mng_bool)(!pImage->bVisible);
|
|
|
|
if (pImage->bVisible)
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 5 : {
|
|
|
|
pImage->bVisible = (mng_bool)(!pImage->bVisible);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bTimerset) /* next ? */
|
|
|
|
iX += iS;
|
|
|
|
|
|
|
|
} /* continue ? */
|
|
|
|
while ((!pData->bTimerset) && (((iS > 0) && (iX <= iTo)) ||
|
|
|
|
((iS < 0) && (iX >= iTo)) ));
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* timer set ? */
|
|
|
|
{
|
|
|
|
pData->iBreakpoint = 4;
|
|
|
|
pData->iSHOWnextid = iX; /* save for next time */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pData->iBreakpoint = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_save (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
iRetcode = save_state (pData); /* save the current state */
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_seek (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
iRetcode = restore_state (pData); /* restore the initial or SAVE state */
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
mng_retcode process_display_jhdr (mng_datap pData)
|
|
|
|
{ /* address the current "object" if any */
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pCurrentobj;
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->bHasDHDR)
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
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->fDifferrow = MNG_NULL;
|
|
|
|
pData->fStorerow2 = MNG_NULL;
|
|
|
|
pData->fStorerow3 = MNG_NULL;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pData->pStoreobj = MNG_NULL; /* initialize important work-parms */
|
|
|
|
|
|
|
|
pData->iJPEGrow = 0;
|
|
|
|
pData->iJPEGalpharow = 0;
|
|
|
|
pData->iJPEGrgbrow = 0;
|
|
|
|
pData->iRowmax = 0; /* so init_rowproc does the right thing ! */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->iBreakpoint) /* not previously broken ? */
|
|
|
|
{
|
|
|
|
if (pData->bHasDHDR) /* delta-image ? */
|
|
|
|
{
|
|
|
|
if (pData->iDeltatype == MNG_DELTATYPE_REPLACE)
|
|
|
|
{
|
|
|
|
iRetcode = reset_object_details (pData, (mng_imagep)pData->pDeltaImage,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iJHDRimgbitdepth, pData->iJHDRcolortype,
|
|
|
|
pData->iJHDRalphacompression, pData->iJHDRalphafilter,
|
|
|
|
pData->iJHDRalphainterlace, MNG_TRUE);
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression;
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace;
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) )
|
|
|
|
{
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth;
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) )
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
|
|
|
|
else
|
|
|
|
if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) ||
|
|
|
|
(pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) )
|
|
|
|
((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pImage) /* update object buffer ? */
|
|
|
|
{
|
|
|
|
iRetcode = reset_object_details (pData, pImage,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iJHDRimgbitdepth, pData->iJHDRcolortype,
|
|
|
|
pData->iJHDRalphacompression, pData->iJHDRalphafilter,
|
|
|
|
pData->iJHDRalphainterlace, MNG_TRUE);
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
pImage->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
|
|
|
|
pImage->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression;
|
|
|
|
pImage->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace;
|
|
|
|
pImage->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
else /* update object 0 */
|
|
|
|
{
|
|
|
|
iRetcode = reset_object_details (pData, (mng_imagep)pData->pObjzero,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iJHDRimgbitdepth, pData->iJHDRcolortype,
|
|
|
|
pData->iJHDRalphacompression, pData->iJHDRalphafilter,
|
|
|
|
pData->iJHDRalphainterlace, MNG_TRUE);
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
((mng_imagep)pData->pObjzero)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth;
|
|
|
|
((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression;
|
|
|
|
((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace;
|
|
|
|
((mng_imagep)pData->pObjzero)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bHasDHDR)
|
|
|
|
{ /* we're always storing a JPEG */
|
|
|
|
if (pImage) /* real object ? */
|
|
|
|
pData->pStoreobj = pImage; /* tell the row routines */
|
|
|
|
else /* otherwise use object 0 */
|
|
|
|
pData->pStoreobj = pData->pObjzero;
|
|
|
|
/* display "on-the-fly" ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
if ( (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) &&
|
|
|
|
(((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) &&
|
2000-08-08 07:58:05 +04:00
|
|
|
( (pData->eImagetype == mng_it_jng ) ||
|
2000-11-29 09:45:16 +03:00
|
|
|
(((mng_imagep)pData->pStoreobj)->bVisible) ) )
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
|
|
|
next_layer (pData); /* that's a new layer then ! */
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* timer break ? */
|
|
|
|
pData->iBreakpoint = 7;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pData->iBreakpoint = 0;
|
|
|
|
/* anything to display ? */
|
|
|
|
if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt))
|
|
|
|
{
|
|
|
|
set_display_routine (pData); /* then determine display routine */
|
|
|
|
/* display from the object we store in */
|
|
|
|
pData->pRetrieveobj = pData->pStoreobj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pData->bTimerset) /* no timer break ? */
|
2001-05-20 21:36:25 +04:00
|
|
|
{ /* default row initialization ! */
|
|
|
|
pData->fInitrowproc = (mng_fptr)init_rowproc;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE))
|
|
|
|
{ /* 8-bit JPEG ? */
|
|
|
|
if (pData->iJHDRimgbitdepth == 8)
|
2000-06-14 18:20:55 +04:00
|
|
|
{ /* intermediate row is 8-bit deep */
|
|
|
|
pData->bIsRGBA16 = MNG_FALSE;
|
|
|
|
pData->iRowsamples = pData->iDatawidth;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
switch (pData->iJHDRcolortype) /* determine pixel processing routines */
|
|
|
|
{
|
|
|
|
case MNG_COLORTYPE_JPEGGRAY :
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fStorerow2 = (mng_fptr)store_jpeg_g8;
|
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_g8;
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->bIsOpaque = MNG_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_COLORTYPE_JPEGCOLOR :
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fStorerow2 = (mng_fptr)store_jpeg_rgb8;
|
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgb8;
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->bIsOpaque = MNG_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_COLORTYPE_JPEGGRAYA :
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fStorerow2 = (mng_fptr)store_jpeg_ga8;
|
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_ga8;
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->bIsOpaque = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_COLORTYPE_JPEGCOLORA :
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fStorerow2 = (mng_fptr)store_jpeg_rgba8;
|
|
|
|
pData->fRetrieverow = (mng_fptr)retrieve_rgba8;
|
2000-06-13 03:06:35 +04:00
|
|
|
pData->bIsOpaque = MNG_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */
|
|
|
|
|
|
|
|
/* TODO: 12-bit JPEG */
|
|
|
|
/* TODO: 8- + 12-bit JPEG (eg. type=20) */
|
|
|
|
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
/* possible IDAT alpha-channel ? */
|
|
|
|
if (pData->iJHDRalphacompression == MNG_COMPRESSION_DEFLATE)
|
2000-06-13 03:06:35 +04:00
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
/* determine alpha processing routine */
|
|
|
|
switch (pData->iJHDRalphabitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
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; }
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
else /* possible JDAA alpha-channel ? */
|
|
|
|
if (pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG)
|
|
|
|
{ /* 8-bit JPEG ? */
|
|
|
|
if (pData->iJHDRimgbitdepth == 8)
|
|
|
|
{
|
|
|
|
if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fStorerow3 = (mng_fptr)store_jpeg_g8_alpha;
|
2000-11-29 09:45:16 +03:00
|
|
|
else
|
|
|
|
if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fStorerow3 = (mng_fptr)store_jpeg_rgb8_alpha;
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* TODO: 12-bit JPEG with 8-bit JDAA */
|
|
|
|
}
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
/* initialize JPEG library */
|
|
|
|
iRetcode = mngjpeg_initialize (pData);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ /* must be alpha add/replace !! */
|
|
|
|
if ((pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAADD ) &&
|
|
|
|
(pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAREPLACE) )
|
|
|
|
MNG_ERROR (pData, MNG_INVDELTATYPE)
|
|
|
|
/* determine alpha processing routine */
|
|
|
|
switch (pData->iJHDRalphabitdepth)
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
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; }
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
pData->iFilterofs = 0; /* determine filter characteristics */
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->iLevel0 = 0; /* default levels */
|
|
|
|
pData->iLevel1 = 0;
|
|
|
|
pData->iLevel2 = 0;
|
|
|
|
pData->iLevel3 = 0;
|
2000-11-29 09:45:16 +03:00
|
|
|
/* leveling & differing ? */
|
2001-01-30 04:04:13 +03:00
|
|
|
/* if (pData->iJHDRalphafilter & 0x40)
|
2000-11-29 09:45:16 +03:00
|
|
|
{
|
|
|
|
if (pData->iJHDRalphabitdepth <= 8)
|
|
|
|
pData->iFilterofs = 1;
|
|
|
|
else
|
|
|
|
pData->iFilterofs = 2;
|
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
} */
|
2000-11-29 09:45:16 +03:00
|
|
|
/* no adaptive filtering ? */
|
2001-01-30 04:04:13 +03:00
|
|
|
/* if (pData->iJHDRalphafilter & 0x01)
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPixelofs = pData->iFilterofs;
|
2001-01-30 04:04:13 +03:00
|
|
|
else */
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iPixelofs = pData->iFilterofs + 1;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
#endif /* MNG_INCLUDE_JNG */
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
mng_retcode process_display_jdaa (mng_datap pData,
|
|
|
|
mng_uint32 iRawlen,
|
|
|
|
mng_uint8p pRawdata)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!pData->bJPEGdecompress2) /* if we're not decompressing already */
|
|
|
|
{
|
2001-05-20 21:36:25 +04:00
|
|
|
if (pData->fInitrowproc) /* initialize row-processing? */
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
|
2001-05-20 21:36:25 +04:00
|
|
|
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
|
|
|
|
}
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
if (!iRetcode) /* initialize decompress */
|
|
|
|
iRetcode = mngjpeg_decompressinit2 (pData);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!iRetcode) /* all ok? then decompress, my man */
|
|
|
|
iRetcode = mngjpeg_decompressdata2 (pData, iRawlen, pRawdata);
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
if (iRetcode)
|
|
|
|
return iRetcode;
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
return MNG_NOERROR;
|
2000-11-29 09:45:16 +03:00
|
|
|
}
|
|
|
|
#endif /* MNG_INCLUDE_JNG */
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
mng_retcode process_display_jdat (mng_datap pData,
|
|
|
|
mng_uint32 iRawlen,
|
|
|
|
mng_uint8p pRawdata)
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = MNG_NOERROR;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
if (pData->bRestorebkgd) /* need to restore the background ? */
|
|
|
|
{
|
|
|
|
pData->bRestorebkgd = MNG_FALSE;
|
|
|
|
iRetcode = load_bkgdlayer (pData);
|
|
|
|
|
|
|
|
if ((pData->bDisplaying) && (pData->bRunning))
|
|
|
|
pData->iLayerseq++; /* and it counts as a layer then ! */
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
if (!pData->bJPEGdecompress) /* if we're not decompressing already */
|
|
|
|
{
|
2001-05-20 21:36:25 +04:00
|
|
|
if (pData->fInitrowproc) /* initialize row-processing? */
|
|
|
|
{
|
2000-06-13 03:06:35 +04:00
|
|
|
iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData);
|
2001-05-20 21:36:25 +04:00
|
|
|
pData->fInitrowproc = MNG_NULL; /* only call this once !!! */
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
if (!iRetcode) /* initialize decompress */
|
|
|
|
iRetcode = mngjpeg_decompressinit (pData);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!iRetcode) /* all ok? then decompress, my man */
|
|
|
|
iRetcode = mngjpeg_decompressdata (pData, iRawlen, pRawdata);
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
if (iRetcode)
|
|
|
|
return iRetcode;
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
2001-05-20 21:36:25 +04:00
|
|
|
return MNG_NOERROR;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
#endif /* MNG_INCLUDE_JNG */
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_dhdr (mng_datap pData,
|
|
|
|
mng_uint16 iObjectid,
|
|
|
|
mng_uint8 iImagetype,
|
|
|
|
mng_uint8 iDeltatype,
|
|
|
|
mng_uint32 iBlockwidth,
|
|
|
|
mng_uint32 iBlockheight,
|
|
|
|
mng_uint32 iBlockx,
|
|
|
|
mng_uint32 iBlocky)
|
|
|
|
{
|
2000-06-24 02:59:51 +04:00
|
|
|
mng_imagep pImage;
|
|
|
|
mng_retcode iRetcode;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
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;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fDeltagetrow = MNG_NULL;
|
|
|
|
pData->fDeltaaddrow = MNG_NULL;
|
|
|
|
pData->fDeltareplacerow = MNG_NULL;
|
|
|
|
pData->fDeltaputrow = MNG_NULL;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
pImage = find_imageobject (pData, iObjectid);
|
|
|
|
|
|
|
|
if (pImage) /* object exists ? */
|
|
|
|
{
|
|
|
|
if (pImage->pImgbuf->bConcrete) /* is it concrete ? */
|
2000-11-29 09:45:16 +03:00
|
|
|
{ /* previous magnification to be done ? */
|
|
|
|
if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY))
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
iRetcode = magnify_imageobject (pData, pImage);
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
/* save delta fields */
|
|
|
|
pData->pDeltaImage = (mng_ptr)pImage;
|
|
|
|
pData->iDeltaImagetype = iImagetype;
|
|
|
|
pData->iDeltatype = iDeltatype;
|
|
|
|
pData->iDeltaBlockwidth = iBlockwidth;
|
|
|
|
pData->iDeltaBlockheight = iBlockheight;
|
|
|
|
pData->iDeltaBlockx = iBlockx;
|
|
|
|
pData->iDeltaBlocky = iBlocky;
|
2000-06-13 03:06:35 +04:00
|
|
|
/* restore target-object fields */
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iDatawidth = pImage->pImgbuf->iWidth;
|
|
|
|
pData->iDataheight = pImage->pImgbuf->iHeight;
|
|
|
|
pData->iBitdepth = pImage->pImgbuf->iBitdepth;
|
|
|
|
pData->iColortype = pImage->pImgbuf->iColortype;
|
|
|
|
pData->iCompression = pImage->pImgbuf->iCompression;
|
|
|
|
pData->iFilter = pImage->pImgbuf->iFilter;
|
|
|
|
pData->iInterlace = pImage->pImgbuf->iInterlace;
|
|
|
|
|
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
pData->iJHDRimgbitdepth = pImage->pImgbuf->iBitdepth;
|
|
|
|
pData->iJHDRcolortype = pImage->pImgbuf->iColortype;
|
|
|
|
pData->iJHDRimgcompression = pImage->pImgbuf->iJHDRcompression;
|
|
|
|
pData->iJHDRimginterlace = pImage->pImgbuf->iJHDRinterlace;
|
|
|
|
pData->iJHDRalphacompression = pImage->pImgbuf->iCompression;
|
|
|
|
pData->iJHDRalphafilter = pImage->pImgbuf->iFilter;
|
|
|
|
pData->iJHDRalphainterlace = pImage->pImgbuf->iInterlace;
|
|
|
|
pData->iJHDRalphabitdepth = pImage->pImgbuf->iAlphabitdepth;
|
|
|
|
#endif
|
2000-06-13 03:06:35 +04:00
|
|
|
/* block size specified ? */
|
|
|
|
if (iDeltatype != MNG_DELTATYPE_NOCHANGE)
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
pData->iDatawidth = iBlockwidth;
|
|
|
|
pData->iDataheight = iBlockheight;
|
2000-06-13 03:06:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (iDeltatype) /* determine nr of delta-channels */
|
|
|
|
{
|
|
|
|
case MNG_DELTATYPE_BLOCKALPHAADD : ;
|
|
|
|
case MNG_DELTATYPE_BLOCKALPHAREPLACE :
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) ||
|
|
|
|
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) )
|
|
|
|
{
|
|
|
|
pData->iColortype = MNG_COLORTYPE_GRAY;
|
|
|
|
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY;
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2000-11-29 09:45:16 +03:00
|
|
|
if ((pData->iColortype == MNG_COLORTYPE_RGBA ) ||
|
|
|
|
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )
|
|
|
|
{
|
|
|
|
pData->iColortype = MNG_COLORTYPE_GRAY;
|
|
|
|
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (pData->iColortype == MNG_COLORTYPE_GRAYA)
|
|
|
|
pData->iColortype = MNG_COLORTYPE_GRAY;
|
|
|
|
else
|
|
|
|
if (pData->iColortype == MNG_COLORTYPE_RGBA)
|
|
|
|
pData->iColortype = MNG_COLORTYPE_GRAY;
|
|
|
|
#endif
|
2000-06-13 03:06:35 +04:00
|
|
|
else /* target has no alpha; that sucks! */
|
|
|
|
MNG_ERROR (pData, MNG_TARGETNOALPHA)
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case MNG_DELTATYPE_BLOCKCOLORADD : ;
|
|
|
|
case MNG_DELTATYPE_BLOCKCOLORREPLACE :
|
|
|
|
{
|
2000-11-29 09:45:16 +03:00
|
|
|
#ifdef MNG_INCLUDE_JNG
|
|
|
|
if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) ||
|
|
|
|
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) )
|
|
|
|
{
|
|
|
|
pData->iColortype = MNG_COLORTYPE_GRAY;
|
|
|
|
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if ((pData->iColortype == MNG_COLORTYPE_RGBA ) ||
|
|
|
|
(pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )
|
|
|
|
{
|
|
|
|
pData->iColortype = MNG_COLORTYPE_RGB;
|
|
|
|
pData->iJHDRcolortype = MNG_COLORTYPE_JPEGCOLOR;
|
|
|
|
}
|
|
|
|
#else
|
2000-06-13 03:06:35 +04:00
|
|
|
if (pData->iColortype == MNG_COLORTYPE_GRAYA)
|
|
|
|
pData->iColortype = MNG_COLORTYPE_GRAY;
|
|
|
|
else
|
|
|
|
if (pData->iColortype == MNG_COLORTYPE_RGBA)
|
|
|
|
pData->iColortype = MNG_COLORTYPE_RGB;
|
2000-11-29 09:45:16 +03:00
|
|
|
#endif
|
2000-06-13 03:06:35 +04:00
|
|
|
else /* target has no alpha; that sucks! */
|
|
|
|
MNG_ERROR (pData, MNG_TARGETNOALPHA)
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2000-06-24 02:59:51 +04:00
|
|
|
/* full image replace ? */
|
|
|
|
if (iDeltatype == MNG_DELTATYPE_REPLACE)
|
|
|
|
{
|
|
|
|
iRetcode = reset_object_details (pData, pImage,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iBitdepth, pData->iColortype,
|
|
|
|
pData->iCompression, pData->iFilter,
|
|
|
|
pData->iInterlace, MNG_FALSE);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
pData->pStoreobj = pImage; /* and store straight into this object */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mng_imagedatap pBufzero, pBuf;
|
|
|
|
/* we store in object 0 and process it later */
|
|
|
|
pData->pStoreobj = pData->pObjzero;
|
|
|
|
/* make sure to initialize object 0 then */
|
|
|
|
iRetcode = reset_object_details (pData, (mng_imagep)pData->pObjzero,
|
|
|
|
pData->iDatawidth, pData->iDataheight,
|
|
|
|
pData->iBitdepth, pData->iColortype,
|
|
|
|
pData->iCompression, pData->iFilter,
|
|
|
|
pData->iInterlace, MNG_TRUE);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
|
|
|
|
pBuf = pImage->pImgbuf; /* copy possible palette & cheap transparency */
|
|
|
|
pBufzero = ((mng_imagep)pData->pObjzero)->pImgbuf;
|
|
|
|
|
|
|
|
pBufzero->bHasPLTE = pBuf->bHasPLTE;
|
|
|
|
pBufzero->bHasTRNS = pBuf->bHasTRNS;
|
|
|
|
|
|
|
|
if (pBufzero->bHasPLTE) /* copy palette ? */
|
|
|
|
{
|
|
|
|
mng_uint32 iX;
|
|
|
|
|
|
|
|
pBufzero->iPLTEcount = pBuf->iPLTEcount;
|
|
|
|
|
|
|
|
for (iX = 0; iX < pBuf->iPLTEcount; iX++)
|
|
|
|
{
|
|
|
|
pBufzero->aPLTEentries [iX].iRed = pBuf->aPLTEentries [iX].iRed;
|
|
|
|
pBufzero->aPLTEentries [iX].iGreen = pBuf->aPLTEentries [iX].iGreen;
|
|
|
|
pBufzero->aPLTEentries [iX].iBlue = pBuf->aPLTEentries [iX].iBlue;
|
|
|
|
}
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
if (pBufzero->bHasTRNS) /* copy cheap transparency ? */
|
|
|
|
{
|
|
|
|
pBufzero->iTRNSgray = pBuf->iTRNSgray;
|
|
|
|
pBufzero->iTRNSred = pBuf->iTRNSred;
|
|
|
|
pBufzero->iTRNSgreen = pBuf->iTRNSgreen;
|
|
|
|
pBufzero->iTRNSblue = pBuf->iTRNSblue;
|
|
|
|
pBufzero->iTRNScount = pBuf->iTRNScount;
|
|
|
|
|
2000-08-08 07:58:05 +04:00
|
|
|
MNG_COPY (pBufzero->aTRNSentries, pBuf->aTRNSentries,
|
2000-06-24 02:59:51 +04:00
|
|
|
sizeof (pBufzero->aTRNSentries))
|
|
|
|
}
|
|
|
|
/* process immediatly if bitdepth & colortype are equal */
|
|
|
|
pData->bDeltaimmediate =
|
2000-11-29 09:45:16 +03:00
|
|
|
(mng_bool)((pData->bDisplaying) && (pData->bRunning) &&
|
|
|
|
(pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&
|
2000-06-24 02:59:51 +04:00
|
|
|
(pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) );
|
|
|
|
}
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
switch (pData->iColortype) /* determine row initialization routine */
|
|
|
|
{
|
|
|
|
case 0 : { /* gray */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g1_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g1_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g2_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g2_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g4_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g4_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_g16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : { /* rgb */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgb16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3 : { /* indexed */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 1 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx1_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx1_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx2_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx2_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx4_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx4_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_idx8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4 : { /* gray+alpha */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_ga16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6 : { /* rgb+alpha */
|
|
|
|
switch (pData->iBitdepth)
|
|
|
|
{
|
|
|
|
case 8 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba8_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba8_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16 : {
|
|
|
|
if (!pData->iInterlace)
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba16_ni;
|
2000-06-13 03:06:35 +04:00
|
|
|
else
|
2001-01-30 04:04:13 +03:00
|
|
|
pData->fInitrowproc = (mng_fptr)init_rgba16_i;
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
MNG_ERROR (pData, MNG_OBJNOTCONCRETE)
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
MNG_ERROR (pData, MNG_OBJECTUNKNOWN)
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_prom (mng_datap pData,
|
|
|
|
mng_uint8 iBitdepth,
|
|
|
|
mng_uint8 iColortype,
|
|
|
|
mng_uint8 iFilltype)
|
|
|
|
{
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
/* TODO: everything */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_ipng (mng_datap pData)
|
|
|
|
{
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* indicate it for what it is now */
|
|
|
|
pData->iDeltaImagetype = MNG_IMAGETYPE_PNG;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_ijng (mng_datap pData)
|
|
|
|
{
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* indicate it for what it is now */
|
|
|
|
pData->iDeltaImagetype = MNG_IMAGETYPE_JNG;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-24 02:59:51 +04:00
|
|
|
mng_retcode process_display_pplt (mng_datap pData,
|
|
|
|
mng_uint8 iType,
|
|
|
|
mng_uint32 iCount,
|
2000-08-08 07:58:05 +04:00
|
|
|
mng_palette8ep paIndexentries,
|
|
|
|
mng_uint8p paAlphaentries,
|
|
|
|
mng_uint8p paUsedentries)
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
|
|
|
mng_uint32 iX;
|
|
|
|
mng_imagep pImage = (mng_imagep)pData->pObjzero;
|
|
|
|
mng_imagedatap pBuf = pImage->pImgbuf;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (iType)
|
|
|
|
{
|
|
|
|
case MNG_DELTATYPE_REPLACERGB :
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < iCount; iX++)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
if (paUsedentries [iX])
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed;
|
|
|
|
pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen;
|
|
|
|
pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue;
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_DELTATYPE_DELTARGB :
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < iCount; iX++)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
if (paUsedentries [iX])
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
|
|
|
pBuf->aPLTEentries [iX].iRed =
|
|
|
|
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
|
2000-08-08 07:58:05 +04:00
|
|
|
paIndexentries [iX].iRed );
|
2000-06-24 02:59:51 +04:00
|
|
|
pBuf->aPLTEentries [iX].iGreen =
|
|
|
|
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
|
2000-08-08 07:58:05 +04:00
|
|
|
paIndexentries [iX].iGreen);
|
2000-06-24 02:59:51 +04:00
|
|
|
pBuf->aPLTEentries [iX].iBlue =
|
|
|
|
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
|
2000-08-08 07:58:05 +04:00
|
|
|
paIndexentries [iX].iBlue );
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_DELTATYPE_REPLACEALPHA :
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < iCount; iX++)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
if (paUsedentries [iX])
|
|
|
|
pBuf->aTRNSentries [iX] = paAlphaentries [iX];
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_DELTATYPE_DELTAALPHA :
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < iCount; iX++)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
if (paUsedentries [iX])
|
2000-06-24 02:59:51 +04:00
|
|
|
pBuf->aTRNSentries [iX] =
|
|
|
|
(mng_uint8)(pBuf->aTRNSentries [iX] +
|
2000-08-08 07:58:05 +04:00
|
|
|
paAlphaentries [iX]);
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_DELTATYPE_REPLACERGBA :
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < iCount; iX++)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
if (paUsedentries [iX])
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed;
|
|
|
|
pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen;
|
|
|
|
pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue;
|
|
|
|
pBuf->aTRNSentries [iX] = paAlphaentries [iX];
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MNG_DELTATYPE_DELTARGBA :
|
|
|
|
{
|
|
|
|
for (iX = 0; iX < iCount; iX++)
|
|
|
|
{
|
2000-08-08 07:58:05 +04:00
|
|
|
if (paUsedentries [iX])
|
2000-06-24 02:59:51 +04:00
|
|
|
{
|
|
|
|
pBuf->aPLTEentries [iX].iRed =
|
|
|
|
(mng_uint8)(pBuf->aPLTEentries [iX].iRed +
|
2000-08-08 07:58:05 +04:00
|
|
|
paIndexentries [iX].iRed );
|
2000-06-24 02:59:51 +04:00
|
|
|
pBuf->aPLTEentries [iX].iGreen =
|
|
|
|
(mng_uint8)(pBuf->aPLTEentries [iX].iGreen +
|
2000-08-08 07:58:05 +04:00
|
|
|
paIndexentries [iX].iGreen);
|
2000-06-24 02:59:51 +04:00
|
|
|
pBuf->aPLTEentries [iX].iBlue =
|
|
|
|
(mng_uint8)(pBuf->aPLTEentries [iX].iBlue +
|
2000-08-08 07:58:05 +04:00
|
|
|
paIndexentries [iX].iBlue );
|
2000-06-24 02:59:51 +04:00
|
|
|
pBuf->aTRNSentries [iX] =
|
|
|
|
(mng_uint8)(pBuf->aTRNSentries [iX] +
|
2000-08-08 07:58:05 +04:00
|
|
|
paAlphaentries [iX]);
|
2000-06-24 02:59:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((iType != MNG_DELTATYPE_REPLACERGB) && (iType != MNG_DELTATYPE_DELTARGB))
|
|
|
|
{
|
|
|
|
if (pBuf->bHasTRNS)
|
|
|
|
{
|
|
|
|
if (iCount > pBuf->iTRNScount)
|
|
|
|
pBuf->iTRNScount = iCount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pBuf->iTRNScount = iCount;
|
|
|
|
pBuf->bHasTRNS = MNG_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((iType != MNG_DELTATYPE_REPLACEALPHA) && (iType != MNG_DELTATYPE_DELTAALPHA))
|
|
|
|
{
|
|
|
|
if (iCount > pBuf->iPLTEcount)
|
|
|
|
pBuf->iPLTEcount = iCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-11-29 09:45:16 +03:00
|
|
|
mng_retcode process_display_magn (mng_datap pData,
|
|
|
|
mng_uint16 iFirstid,
|
|
|
|
mng_uint16 iLastid,
|
|
|
|
mng_uint16 iMethodX,
|
|
|
|
mng_uint16 iMX,
|
|
|
|
mng_uint16 iMY,
|
|
|
|
mng_uint16 iML,
|
|
|
|
mng_uint16 iMR,
|
|
|
|
mng_uint16 iMT,
|
|
|
|
mng_uint16 iMB,
|
|
|
|
mng_uint16 iMethodY)
|
|
|
|
{
|
|
|
|
mng_uint16 iX;
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
/* iterate the object-ids */
|
|
|
|
for (iX = iFirstid; iX <= iLastid; iX++)
|
|
|
|
{
|
|
|
|
if (iX == 0) /* process object 0 ? */
|
|
|
|
{
|
2001-01-30 04:04:13 +03:00
|
|
|
pImage = (mng_imagep)pData->pObjzero;
|
2000-11-29 09:45:16 +03:00
|
|
|
|
|
|
|
pImage->iMAGN_MethodX = iMethodX;
|
|
|
|
pImage->iMAGN_MethodY = iMethodY;
|
|
|
|
pImage->iMAGN_MX = iMX;
|
|
|
|
pImage->iMAGN_MY = iMY;
|
|
|
|
pImage->iMAGN_ML = iML;
|
|
|
|
pImage->iMAGN_MR = iMR;
|
|
|
|
pImage->iMAGN_MT = iMT;
|
|
|
|
pImage->iMAGN_MB = iMB;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, iX);
|
|
|
|
/* object exists & is not frozen ? */
|
|
|
|
if ((pImage) && (!pImage->bFrozen))
|
|
|
|
{ /* previous magnification to be done ? */
|
|
|
|
if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY))
|
|
|
|
{
|
|
|
|
mng_retcode iRetcode = magnify_imageobject (pData, pImage);
|
|
|
|
|
|
|
|
if (iRetcode) /* on error bail out */
|
|
|
|
return iRetcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
pImage->iMAGN_MethodX = iMethodX;
|
|
|
|
pImage->iMAGN_MethodY = iMethodY;
|
|
|
|
pImage->iMAGN_MX = iMX;
|
|
|
|
pImage->iMAGN_MY = iMY;
|
|
|
|
pImage->iMAGN_ML = iML;
|
|
|
|
pImage->iMAGN_MR = iMR;
|
|
|
|
pImage->iMAGN_MT = iMT;
|
|
|
|
pImage->iMAGN_MB = iMB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
iX = iFirstid;
|
|
|
|
/* iterate again for showing */
|
|
|
|
while ((iX <= iLastid) && (!pData->bTimerset))
|
|
|
|
{
|
|
|
|
if (iX) /* only real objects ! */
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, iX);
|
|
|
|
/* object exists & is not frozen &
|
|
|
|
is visible & is viewable ? */
|
|
|
|
if ((pImage) && (!pImage->bFrozen) &&
|
|
|
|
(pImage->bVisible) && (pImage->bViewable))
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
iX++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* broken ? */
|
|
|
|
{
|
|
|
|
pData->iMAGNfromid = iFirstid;
|
|
|
|
pData->iMAGNtoid = iLastid;
|
|
|
|
pData->iBreakpoint = 9;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
mng_retcode process_display_magn2 (mng_datap pData)
|
|
|
|
{
|
|
|
|
mng_uint16 iX;
|
|
|
|
mng_imagep pImage;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
iX = pData->iMAGNfromid;
|
|
|
|
/* iterate again for showing */
|
|
|
|
while ((iX <= pData->iMAGNtoid) && (!pData->bTimerset))
|
|
|
|
{
|
|
|
|
if (iX) /* only real objects ! */
|
|
|
|
{
|
|
|
|
pImage = find_imageobject (pData, iX);
|
|
|
|
/* object exists & is not frozen &
|
|
|
|
is visible & is viewable ? */
|
|
|
|
if ((pImage) && (!pImage->bFrozen) &&
|
|
|
|
(pImage->bVisible) && (pImage->bViewable))
|
|
|
|
display_image (pData, pImage, MNG_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
iX++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pData->bTimerset) /* broken ? */
|
|
|
|
pData->iBreakpoint = 9;
|
|
|
|
|
|
|
|
#ifdef MNG_SUPPORT_TRACE
|
|
|
|
MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return MNG_NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2000-06-13 03:06:35 +04:00
|
|
|
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
/* * end of file * */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|