0
|
1 |
/* ************************************************************************** */
|
|
2 |
/* * For conditions of distribution and use, * */
|
|
3 |
/* * see copyright notice in libmng.h * */
|
|
4 |
/* ************************************************************************** */
|
|
5 |
/* * * */
|
|
6 |
/* * project : libmng * */
|
|
7 |
/* * file : libmng_object_prc.c copyright (c) 2000-2007 G.Juyn * */
|
|
8 |
/* * version : 1.0.10 * */
|
|
9 |
/* * * */
|
|
10 |
/* * purpose : Object processing routines (implementation) * */
|
|
11 |
/* * * */
|
|
12 |
/* * author : G.Juyn * */
|
|
13 |
/* * * */
|
|
14 |
/* * comment : implementation of the internal object processing routines * */
|
|
15 |
/* * * */
|
|
16 |
/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
|
17 |
/* * - changed strict-ANSI stuff * */
|
|
18 |
/* * 0.5.1 - 05/12/2000 - G.Juyn * */
|
|
19 |
/* * - changed trace to macro for callback error-reporting * */
|
|
20 |
/* * * */
|
|
21 |
/* * 0.5.2 - 05/20/2000 - G.Juyn * */
|
|
22 |
/* * - fixed to support JNG objects * */
|
|
23 |
/* * 0.5.2 - 05/24/2000 - G.Juyn * */
|
|
24 |
/* * - added support for global color-chunks in animation * */
|
|
25 |
/* * - added support for global PLTE,tRNS,bKGD in animation * */
|
|
26 |
/* * - added SAVE & SEEK animation objects * */
|
|
27 |
/* * 0.5.2 - 05/29/2000 - G.Juyn * */
|
|
28 |
/* * - added initialization of framenr/layernr/playtime * */
|
|
29 |
/* * - changed ani_object create routines not to return the * */
|
|
30 |
/* * created object (wasn't necessary) * */
|
|
31 |
/* * 0.5.2 - 05/30/2000 - G.Juyn * */
|
|
32 |
/* * - added object promotion routine (PROM handling) * */
|
|
33 |
/* * - added ani-object routines for delta-image processing * */
|
|
34 |
/* * - added compression/filter/interlace fields to * */
|
|
35 |
/* * object-buffer for delta-image processing * */
|
|
36 |
/* * * */
|
|
37 |
/* * 0.5.3 - 06/17/2000 - G.Juyn * */
|
|
38 |
/* * - changed support for delta-image processing * */
|
|
39 |
/* * 0.5.3 - 06/20/2000 - G.Juyn * */
|
|
40 |
/* * - fixed some small things (as precaution) * */
|
|
41 |
/* * 0.5.3 - 06/21/2000 - G.Juyn * */
|
|
42 |
/* * - added processing of PLTE/tRNS & color-info for * */
|
|
43 |
/* * delta-images in the ani_objects chain * */
|
|
44 |
/* * 0.5.3 - 06/22/2000 - G.Juyn * */
|
|
45 |
/* * - added support for PPLT chunk * */
|
|
46 |
/* * * */
|
|
47 |
/* * 0.9.1 - 07/07/2000 - G.Juyn * */
|
|
48 |
/* * - added support for freeze/restart/resume & go_xxxx * */
|
|
49 |
/* * 0.9.1 - 07/16/2000 - G.Juyn * */
|
|
50 |
/* * - fixed support for mng_display() after mng_read() * */
|
|
51 |
/* * * */
|
|
52 |
/* * 0.9.2 - 07/29/2000 - G.Juyn * */
|
|
53 |
/* * - fixed small bugs in display processing * */
|
|
54 |
/* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
|
55 |
/* * - changed file-prefixes * */
|
|
56 |
/* * * */
|
|
57 |
/* * 0.9.3 - 08/07/2000 - G.Juyn * */
|
|
58 |
/* * - B111300 - fixup for improved portability * */
|
|
59 |
/* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
|
60 |
/* * - added MAGN chunk * */
|
|
61 |
/* * 0.9.3 - 09/10/2000 - G.Juyn * */
|
|
62 |
/* * - fixed DEFI behavior * */
|
|
63 |
/* * 0.9.3 - 10/17/2000 - G.Juyn * */
|
|
64 |
/* * - added valid-flag to stored objects for read() / display()* */
|
|
65 |
/* * - added routine to discard "invalid" objects * */
|
|
66 |
/* * 0.9.3 - 10/18/2000 - G.Juyn * */
|
|
67 |
/* * - fixed delta-processing behavior * */
|
|
68 |
/* * 0.9.3 - 10/19/2000 - G.Juyn * */
|
|
69 |
/* * - added storage for pixel-/alpha-sampledepth for delta's * */
|
|
70 |
/* * * */
|
|
71 |
/* * 0.9.4 - 1/18/2001 - G.Juyn * */
|
|
72 |
/* * - removed "old" MAGN methods 3 & 4 * */
|
|
73 |
/* * - added "new" MAGN methods 3, 4 & 5 * */
|
|
74 |
/* * * */
|
|
75 |
/* * 0.9.5 - 1/22/2001 - G.Juyn * */
|
|
76 |
/* * - B129681 - fixed compiler warnings SGI/Irix * */
|
|
77 |
/* * * */
|
|
78 |
/* * 1.0.2 - 06/23/2001 - G.Juyn * */
|
|
79 |
/* * - added optimization option for MNG-video playback * */
|
|
80 |
/* * * */
|
|
81 |
/* * 1.0.5 - 08/15/2002 - G.Juyn * */
|
|
82 |
/* * - completed PROM support * */
|
|
83 |
/* * 1.0.5 - 08/16/2002 - G.Juyn * */
|
|
84 |
/* * - completed MAGN support (16-bit functions) * */
|
|
85 |
/* * 1.0.5 - 08/19/2002 - G.Juyn * */
|
|
86 |
/* * - B597134 - libmng pollutes the linker namespace * */
|
|
87 |
/* * 1.0.5 - 09/13/2002 - G.Juyn * */
|
|
88 |
/* * - fixed read/write of MAGN chunk * */
|
|
89 |
/* * 1.0.5 - 09/15/2002 - G.Juyn * */
|
|
90 |
/* * - added event handling for dynamic MNG * */
|
|
91 |
/* * 1.0.5 - 09/20/2002 - G.Juyn * */
|
|
92 |
/* * - added support for PAST * */
|
|
93 |
/* * 1.0.5 - 09/23/2002 - G.Juyn * */
|
|
94 |
/* * - fixed reset_object_detail to clear old buffer * */
|
|
95 |
/* * - added in-memory color-correction of abstract images * */
|
|
96 |
/* * 1.0.5 - 10/05/2002 - G.Juyn * */
|
|
97 |
/* * - fixed problem with cloned objects marked as invalid * */
|
|
98 |
/* * - fixed problem cloning frozen object_buffers * */
|
|
99 |
/* * 1.0.5 - 10/07/2002 - G.Juyn * */
|
|
100 |
/* * - fixed DISC support * */
|
|
101 |
/* * 1.0.5 - 11/04/2002 - G.Juyn * */
|
|
102 |
/* * - fixed goframe/golayer/gotime processing * */
|
|
103 |
/* * 1.0.5 - 11/07/2002 - G.Juyn * */
|
|
104 |
/* * - fixed magnification bug with object 0 * */
|
|
105 |
/* * 1.0.5 - 01/19/2003 - G.Juyn * */
|
|
106 |
/* * - B664911 - fixed buffer overflow during init * */
|
|
107 |
/* * * */
|
|
108 |
/* * 1.0.6 - 04/19/2003 - G.Juyn * */
|
|
109 |
/* * - fixed problem with infinite loops during readdisplay() * */
|
|
110 |
/* * 1.0.6 - 05/25/2003 - G.R-P * */
|
|
111 |
/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */
|
|
112 |
/* * 1.0.6 - 06/09/2003 - G. R-P * */
|
|
113 |
/* * - added conditionals around 8-bit magn routines * */
|
|
114 |
/* * 1.0.6 - 07/07/2003 - G.R-P * */
|
|
115 |
/* * - added conditionals around some JNG-supporting code * */
|
|
116 |
/* * - removed conditionals around 8-bit magn routines * */
|
|
117 |
/* * - added conditionals around delta-png and 16-bit code * */
|
|
118 |
/* * 1.0.6 - 07/14/2003 - G.R-P * */
|
|
119 |
/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */
|
|
120 |
/* * 1.0.6 - 07/29/2003 - G.Juyn * */
|
|
121 |
/* * - fixed invalid test in promote_imageobject * */
|
|
122 |
/* * 1.0.6 - 07/29/2003 - G.R-P. * */
|
|
123 |
/* * - added conditionals around PAST chunk support * */
|
|
124 |
/* * 1.0.6 - 08/17/2003 - G.R-P. * */
|
|
125 |
/* * - added conditionals around MAGN chunk support * */
|
|
126 |
/* * * */
|
|
127 |
/* * 1.0.7 - 03/21/2004 - G.Juyn * */
|
|
128 |
/* * - fixed some 64-bit platform compiler warnings * */
|
|
129 |
/* * * */
|
|
130 |
/* * 1.0.9 - 10/10/2004 - G.R-P. * */
|
|
131 |
/* * - added MNG_NO_1_2_4BIT_SUPPORT support * */
|
|
132 |
/* * 1.0.9 - 12/05/2004 - G.Juyn * */
|
|
133 |
/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */
|
|
134 |
/* * 1.0.9 - 12/11/2004 - G.Juyn * */
|
|
135 |
/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */
|
|
136 |
/* * 1.0.9 - 12/31/2004 - G.R-P. * */
|
|
137 |
/* * - fixed warnings about possible uninitialized pointers * */
|
|
138 |
/* * 1.0.9 - 01/02/2005 - G.Juyn * */
|
|
139 |
/* * - fixing some compiler-warnings * */
|
|
140 |
/* * * */
|
|
141 |
/* * 1.0.10 - 02/07/2005 - G.Juyn * */
|
|
142 |
/* * - fixed some compiler-warnings * */
|
|
143 |
/* * 1.0.10 - 07/30/2005 - G.Juyn * */
|
|
144 |
/* * - fixed problem with CLON object during readdisplay() * */
|
|
145 |
/* * 1.0.10 - 04/08/2007 - G.Juyn * */
|
|
146 |
/* * - added support for mPNG proposal * */
|
|
147 |
/* * 1.0.10 - 04/12/2007 - G.Juyn * */
|
|
148 |
/* * - added support for ANG proposal * */
|
|
149 |
/* * * */
|
|
150 |
/* ************************************************************************** */
|
|
151 |
|
|
152 |
#include "libmng.h"
|
|
153 |
#include "libmng_data.h"
|
|
154 |
#include "libmng_error.h"
|
|
155 |
#include "libmng_trace.h"
|
|
156 |
#ifdef __BORLANDC__
|
|
157 |
#pragma hdrstop
|
|
158 |
#endif
|
|
159 |
#include "libmng_memory.h"
|
|
160 |
#include "libmng_chunks.h"
|
|
161 |
#include "libmng_objects.h"
|
|
162 |
#include "libmng_display.h"
|
|
163 |
#include "libmng_pixels.h"
|
|
164 |
#include "libmng_object_prc.h"
|
|
165 |
#include "libmng_cms.h"
|
|
166 |
|
|
167 |
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
|
168 |
#pragma option -A /* force ANSI-C */
|
|
169 |
#endif
|
|
170 |
|
|
171 |
/* ************************************************************************** */
|
|
172 |
|
|
173 |
#ifdef MNG_INCLUDE_DISPLAY_PROCS
|
|
174 |
|
|
175 |
/* ************************************************************************** */
|
|
176 |
/* * * */
|
|
177 |
/* * Generic object routines * */
|
|
178 |
/* * * */
|
|
179 |
/* ************************************************************************** */
|
|
180 |
|
|
181 |
mng_retcode mng_drop_invalid_objects (mng_datap pData)
|
|
182 |
{
|
|
183 |
mng_objectp pObject;
|
|
184 |
mng_objectp pNext;
|
|
185 |
mng_cleanupobject fCleanup;
|
|
186 |
|
|
187 |
#ifdef MNG_SUPPORT_TRACE
|
|
188 |
MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_START);
|
|
189 |
#endif
|
|
190 |
|
|
191 |
pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */
|
|
192 |
|
|
193 |
while (pObject) /* more objects to check ? */
|
|
194 |
{
|
|
195 |
pNext = ((mng_object_headerp)pObject)->pNext;
|
|
196 |
/* invalid ? */
|
|
197 |
if (!((mng_imagep)pObject)->bValid)
|
|
198 |
{ /* call appropriate cleanup */
|
|
199 |
fCleanup = ((mng_object_headerp)pObject)->fCleanup;
|
|
200 |
fCleanup (pData, pObject);
|
|
201 |
}
|
|
202 |
|
|
203 |
pObject = pNext; /* neeeext */
|
|
204 |
}
|
|
205 |
|
|
206 |
#ifdef MNG_SUPPORT_TRACE
|
|
207 |
MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_END);
|
|
208 |
#endif
|
|
209 |
|
|
210 |
return MNG_NOERROR;
|
|
211 |
}
|
|
212 |
|
|
213 |
/* ************************************************************************** */
|
|
214 |
|
|
215 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
216 |
MNG_LOCAL mng_retcode create_obj_general (mng_datap pData,
|
|
217 |
mng_size_t iObjsize,
|
|
218 |
mng_cleanupobject fCleanup,
|
|
219 |
mng_processobject fProcess,
|
|
220 |
mng_ptr *ppObject)
|
|
221 |
{
|
|
222 |
mng_object_headerp pWork;
|
|
223 |
|
|
224 |
MNG_ALLOC (pData, pWork, iObjsize);
|
|
225 |
|
|
226 |
pWork->fCleanup = fCleanup;
|
|
227 |
pWork->fProcess = fProcess;
|
|
228 |
pWork->iObjsize = iObjsize;
|
|
229 |
*ppObject = (mng_ptr)pWork;
|
|
230 |
|
|
231 |
return MNG_NOERROR;
|
|
232 |
}
|
|
233 |
|
|
234 |
/* ************************************************************************** */
|
|
235 |
|
|
236 |
MNG_LOCAL mng_retcode mng_free_obj_general (mng_datap pData,
|
|
237 |
mng_objectp pObject)
|
|
238 |
{
|
|
239 |
MNG_FREEX (pData, pObject, ((mng_object_headerp)pObject)->iObjsize);
|
|
240 |
return MNG_NOERROR;
|
|
241 |
}
|
|
242 |
#endif
|
|
243 |
|
|
244 |
/* ************************************************************************** */
|
|
245 |
/* * * */
|
|
246 |
/* * Image-data-object routines * */
|
|
247 |
/* * * */
|
|
248 |
/* * these handle the "object buffer" as defined by the MNG specification * */
|
|
249 |
/* * * */
|
|
250 |
/* ************************************************************************** */
|
|
251 |
|
|
252 |
mng_retcode mng_create_imagedataobject (mng_datap pData,
|
|
253 |
mng_bool bConcrete,
|
|
254 |
mng_bool bViewable,
|
|
255 |
mng_uint32 iWidth,
|
|
256 |
mng_uint32 iHeight,
|
|
257 |
mng_uint8 iBitdepth,
|
|
258 |
mng_uint8 iColortype,
|
|
259 |
mng_uint8 iCompression,
|
|
260 |
mng_uint8 iFilter,
|
|
261 |
mng_uint8 iInterlace,
|
|
262 |
mng_imagedatap *ppObject)
|
|
263 |
{
|
|
264 |
mng_imagedatap pImagedata;
|
|
265 |
mng_uint32 iSamplesize = 0;
|
|
266 |
|
|
267 |
#ifdef MNG_SUPPORT_TRACE
|
|
268 |
MNG_TRACE (pData, MNG_FN_CREATE_IMGDATAOBJECT, MNG_LC_START);
|
|
269 |
#endif
|
|
270 |
/* get a buffer */
|
|
271 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
272 |
{
|
|
273 |
mng_ptr pTemp;
|
|
274 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_imagedata),
|
|
275 |
(mng_cleanupobject)mng_free_imagedataobject,
|
|
276 |
MNG_NULL, &pTemp);
|
|
277 |
if (iRetcode)
|
|
278 |
return iRetcode;
|
|
279 |
pImagedata = (mng_imagedatap)pTemp;
|
|
280 |
}
|
|
281 |
#else
|
|
282 |
MNG_ALLOC (pData, pImagedata, sizeof (mng_imagedata));
|
|
283 |
/* fill the appropriate fields */
|
|
284 |
pImagedata->sHeader.fCleanup = (mng_cleanupobject)mng_free_imagedataobject;
|
|
285 |
pImagedata->sHeader.fProcess = MNG_NULL;
|
|
286 |
#endif
|
|
287 |
pImagedata->iRefcount = 1;
|
|
288 |
pImagedata->bFrozen = MNG_FALSE;
|
|
289 |
pImagedata->bConcrete = bConcrete;
|
|
290 |
pImagedata->bViewable = bViewable;
|
|
291 |
pImagedata->iWidth = iWidth;
|
|
292 |
pImagedata->iHeight = iHeight;
|
|
293 |
pImagedata->iBitdepth = iBitdepth;
|
|
294 |
pImagedata->iColortype = iColortype;
|
|
295 |
pImagedata->iCompression = iCompression;
|
|
296 |
pImagedata->iFilter = iFilter;
|
|
297 |
pImagedata->iInterlace = iInterlace;
|
|
298 |
pImagedata->bCorrected = MNG_FALSE;
|
|
299 |
pImagedata->iAlphabitdepth = 0;
|
|
300 |
pImagedata->iJHDRcompression = 0;
|
|
301 |
pImagedata->iJHDRinterlace = 0;
|
|
302 |
pImagedata->iPixelsampledepth = iBitdepth;
|
|
303 |
pImagedata->iAlphasampledepth = iBitdepth;
|
|
304 |
/* determine samplesize from color_type/bit_depth */
|
|
305 |
switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */
|
|
306 |
{
|
|
307 |
case 0 : ; /* gray */
|
|
308 |
case 8 : { /* JPEG gray */
|
|
309 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
310 |
if (iBitdepth > 8)
|
|
311 |
iSamplesize = 2;
|
|
312 |
else
|
|
313 |
#endif
|
|
314 |
iSamplesize = 1;
|
|
315 |
|
|
316 |
break;
|
|
317 |
}
|
|
318 |
case 2 : ; /* rgb */
|
|
319 |
case 10 : { /* JPEG rgb */
|
|
320 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
321 |
if (iBitdepth > 8)
|
|
322 |
iSamplesize = 6;
|
|
323 |
else
|
|
324 |
#endif
|
|
325 |
iSamplesize = 3;
|
|
326 |
|
|
327 |
break;
|
|
328 |
}
|
|
329 |
case 3 : { /* indexed */
|
|
330 |
iSamplesize = 1;
|
|
331 |
break;
|
|
332 |
}
|
|
333 |
case 4 : ; /* gray+alpha */
|
|
334 |
case 12 : { /* JPEG gray+alpha */
|
|
335 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
336 |
if (iBitdepth > 8)
|
|
337 |
iSamplesize = 4;
|
|
338 |
else
|
|
339 |
#endif
|
|
340 |
iSamplesize = 2;
|
|
341 |
|
|
342 |
break;
|
|
343 |
}
|
|
344 |
case 6 : ; /* rgb+alpha */
|
|
345 |
case 14 : { /* JPEG rgb+alpha */
|
|
346 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
347 |
if (iBitdepth > 8)
|
|
348 |
iSamplesize = 8;
|
|
349 |
else
|
|
350 |
#endif
|
|
351 |
iSamplesize = 4;
|
|
352 |
|
|
353 |
break;
|
|
354 |
}
|
|
355 |
}
|
|
356 |
/* make sure we remember all this */
|
|
357 |
pImagedata->iSamplesize = iSamplesize;
|
|
358 |
pImagedata->iRowsize = iSamplesize * iWidth;
|
|
359 |
pImagedata->iImgdatasize = pImagedata->iRowsize * iHeight;
|
|
360 |
|
|
361 |
if (pImagedata->iImgdatasize) /* need a buffer ? */
|
|
362 |
{ /* so allocate it */
|
|
363 |
MNG_ALLOCX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize);
|
|
364 |
|
|
365 |
if (!pImagedata->pImgdata) /* enough memory ? */
|
|
366 |
{
|
|
367 |
MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata));
|
|
368 |
MNG_ERROR (pData, MNG_OUTOFMEMORY);
|
|
369 |
}
|
|
370 |
}
|
|
371 |
/* check global stuff */
|
|
372 |
pImagedata->bHasGAMA = pData->bHasglobalGAMA;
|
|
373 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
374 |
pImagedata->bHasCHRM = pData->bHasglobalCHRM;
|
|
375 |
#endif
|
|
376 |
pImagedata->bHasSRGB = pData->bHasglobalSRGB;
|
|
377 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
378 |
pImagedata->bHasICCP = pData->bHasglobalICCP;
|
|
379 |
#endif
|
|
380 |
#ifndef MNG_SKIPCHUNK_bKGD
|
|
381 |
pImagedata->bHasBKGD = pData->bHasglobalBKGD;
|
|
382 |
#endif
|
|
383 |
|
|
384 |
if (pData->bHasglobalGAMA) /* global gAMA present ? */
|
|
385 |
pImagedata->iGamma = pData->iGlobalGamma;
|
|
386 |
|
|
387 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
388 |
if (pData->bHasglobalCHRM) /* global cHRM present ? */
|
|
389 |
{
|
|
390 |
pImagedata->iWhitepointx = pData->iGlobalWhitepointx;
|
|
391 |
pImagedata->iWhitepointy = pData->iGlobalWhitepointy;
|
|
392 |
pImagedata->iPrimaryredx = pData->iGlobalPrimaryredx;
|
|
393 |
pImagedata->iPrimaryredy = pData->iGlobalPrimaryredy;
|
|
394 |
pImagedata->iPrimarygreenx = pData->iGlobalPrimarygreenx;
|
|
395 |
pImagedata->iPrimarygreeny = pData->iGlobalPrimarygreeny;
|
|
396 |
pImagedata->iPrimarybluex = pData->iGlobalPrimarybluex;
|
|
397 |
pImagedata->iPrimarybluey = pData->iGlobalPrimarybluey;
|
|
398 |
}
|
|
399 |
#endif
|
|
400 |
|
|
401 |
if (pData->bHasglobalSRGB) /* glbal sRGB present ? */
|
|
402 |
pImagedata->iRenderingintent = pData->iGlobalRendintent;
|
|
403 |
|
|
404 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
405 |
if (pData->bHasglobalICCP) /* glbal iCCP present ? */
|
|
406 |
{
|
|
407 |
pImagedata->iProfilesize = pData->iGlobalProfilesize;
|
|
408 |
|
|
409 |
if (pImagedata->iProfilesize)
|
|
410 |
{
|
|
411 |
MNG_ALLOCX (pData, pImagedata->pProfile, pImagedata->iProfilesize);
|
|
412 |
|
|
413 |
if (!pImagedata->pProfile) /* enough memory ? */
|
|
414 |
{
|
|
415 |
MNG_FREEX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize);
|
|
416 |
MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata));
|
|
417 |
MNG_ERROR (pData, MNG_OUTOFMEMORY);
|
|
418 |
}
|
|
419 |
|
|
420 |
MNG_COPY (pImagedata->pProfile, pData->pGlobalProfile, pImagedata->iProfilesize);
|
|
421 |
}
|
|
422 |
}
|
|
423 |
#endif
|
|
424 |
|
|
425 |
#ifndef MNG_SKIPCHUNK_bKGD
|
|
426 |
if (pData->bHasglobalBKGD) /* global bKGD present ? */
|
|
427 |
{
|
|
428 |
pImagedata->iBKGDred = pData->iGlobalBKGDred;
|
|
429 |
pImagedata->iBKGDgreen = pData->iGlobalBKGDgreen;
|
|
430 |
pImagedata->iBKGDblue = pData->iGlobalBKGDblue;
|
|
431 |
}
|
|
432 |
#endif
|
|
433 |
|
|
434 |
*ppObject = pImagedata; /* return it */
|
|
435 |
|
|
436 |
#ifdef MNG_SUPPORT_TRACE
|
|
437 |
MNG_TRACE (pData, MNG_FN_CREATE_IMGDATAOBJECT, MNG_LC_END);
|
|
438 |
#endif
|
|
439 |
|
|
440 |
return MNG_NOERROR;
|
|
441 |
}
|
|
442 |
|
|
443 |
/* ************************************************************************** */
|
|
444 |
|
|
445 |
mng_retcode mng_free_imagedataobject (mng_datap pData,
|
|
446 |
mng_imagedatap pImagedata)
|
|
447 |
{
|
|
448 |
#ifdef MNG_SUPPORT_TRACE
|
|
449 |
MNG_TRACE (pData, MNG_FN_FREE_IMGDATAOBJECT, MNG_LC_START);
|
|
450 |
#endif
|
|
451 |
|
|
452 |
if (pImagedata->iRefcount) /* decrease reference count */
|
|
453 |
pImagedata->iRefcount--;
|
|
454 |
|
|
455 |
if (!pImagedata->iRefcount) /* reached zero ? */
|
|
456 |
{
|
|
457 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
458 |
if (pImagedata->iProfilesize) /* stored an iCCP profile ? */
|
|
459 |
MNG_FREEX (pData, pImagedata->pProfile, pImagedata->iProfilesize);
|
|
460 |
#endif
|
|
461 |
if (pImagedata->iImgdatasize) /* sample-buffer present ? */
|
|
462 |
MNG_FREEX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize);
|
|
463 |
/* drop the buffer */
|
|
464 |
MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata));
|
|
465 |
}
|
|
466 |
|
|
467 |
#ifdef MNG_SUPPORT_TRACE
|
|
468 |
MNG_TRACE (pData, MNG_FN_FREE_IMGDATAOBJECT, MNG_LC_END);
|
|
469 |
#endif
|
|
470 |
|
|
471 |
return MNG_NOERROR;
|
|
472 |
}
|
|
473 |
|
|
474 |
/* ************************************************************************** */
|
|
475 |
|
|
476 |
mng_retcode mng_clone_imagedataobject (mng_datap pData,
|
|
477 |
mng_bool bConcrete,
|
|
478 |
mng_imagedatap pSource,
|
|
479 |
mng_imagedatap *ppClone)
|
|
480 |
{
|
|
481 |
mng_imagedatap pNewdata;
|
|
482 |
|
|
483 |
#ifdef MNG_SUPPORT_TRACE
|
|
484 |
MNG_TRACE (pData, MNG_FN_CLONE_IMGDATAOBJECT, MNG_LC_START);
|
|
485 |
#endif
|
|
486 |
/* get a buffer */
|
|
487 |
MNG_ALLOC (pData, pNewdata, sizeof (mng_imagedata));
|
|
488 |
/* blatently copy the original buffer */
|
|
489 |
MNG_COPY (pNewdata, pSource, sizeof (mng_imagedata));
|
|
490 |
|
|
491 |
pNewdata->iRefcount = 1; /* only the reference count */
|
|
492 |
pNewdata->bConcrete = bConcrete; /* and concrete-flag are different */
|
|
493 |
pNewdata->bFrozen = MNG_FALSE;
|
|
494 |
|
|
495 |
if (pNewdata->iImgdatasize) /* sample buffer present ? */
|
|
496 |
{
|
|
497 |
MNG_ALLOCX (pData, pNewdata->pImgdata, pNewdata->iImgdatasize);
|
|
498 |
|
|
499 |
if (!pNewdata->pImgdata) /* not enough memory ? */
|
|
500 |
{
|
|
501 |
MNG_FREEX (pData, pNewdata, sizeof (mng_imagedata));
|
|
502 |
MNG_ERROR (pData, MNG_OUTOFMEMORY);
|
|
503 |
}
|
|
504 |
/* make a copy */
|
|
505 |
MNG_COPY (pNewdata->pImgdata, pSource->pImgdata, pNewdata->iImgdatasize);
|
|
506 |
}
|
|
507 |
|
|
508 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
509 |
if (pNewdata->iProfilesize) /* iCCP profile present ? */
|
|
510 |
{
|
|
511 |
MNG_ALLOCX (pData, pNewdata->pProfile, pNewdata->iProfilesize);
|
|
512 |
|
|
513 |
if (!pNewdata->pProfile) /* enough memory ? */
|
|
514 |
{
|
|
515 |
MNG_FREEX (pData, pNewdata, sizeof (mng_imagedata));
|
|
516 |
MNG_ERROR (pData, MNG_OUTOFMEMORY);
|
|
517 |
}
|
|
518 |
/* make a copy */
|
|
519 |
MNG_COPY (pNewdata->pProfile, pSource->pProfile, pNewdata->iProfilesize);
|
|
520 |
}
|
|
521 |
#endif
|
|
522 |
|
|
523 |
*ppClone = pNewdata; /* return the clone */
|
|
524 |
|
|
525 |
#ifdef MNG_SUPPORT_TRACE
|
|
526 |
MNG_TRACE (pData, MNG_FN_CLONE_IMGDATAOBJECT, MNG_LC_END);
|
|
527 |
#endif
|
|
528 |
|
|
529 |
return MNG_NOERROR;
|
|
530 |
}
|
|
531 |
|
|
532 |
/* ************************************************************************** */
|
|
533 |
/* * * */
|
|
534 |
/* * Image-object routines * */
|
|
535 |
/* * * */
|
|
536 |
/* * these handle the "object" as defined by the MNG specification * */
|
|
537 |
/* * * */
|
|
538 |
/* ************************************************************************** */
|
|
539 |
|
|
540 |
mng_retcode mng_create_imageobject (mng_datap pData,
|
|
541 |
mng_uint16 iId,
|
|
542 |
mng_bool bConcrete,
|
|
543 |
mng_bool bVisible,
|
|
544 |
mng_bool bViewable,
|
|
545 |
mng_uint32 iWidth,
|
|
546 |
mng_uint32 iHeight,
|
|
547 |
mng_uint8 iBitdepth,
|
|
548 |
mng_uint8 iColortype,
|
|
549 |
mng_uint8 iCompression,
|
|
550 |
mng_uint8 iFilter,
|
|
551 |
mng_uint8 iInterlace,
|
|
552 |
mng_int32 iPosx,
|
|
553 |
mng_int32 iPosy,
|
|
554 |
mng_bool bClipped,
|
|
555 |
mng_int32 iClipl,
|
|
556 |
mng_int32 iClipr,
|
|
557 |
mng_int32 iClipt,
|
|
558 |
mng_int32 iClipb,
|
|
559 |
mng_imagep *ppObject)
|
|
560 |
{
|
|
561 |
mng_imagep pImage;
|
|
562 |
mng_imagep pPrev, pNext;
|
|
563 |
mng_retcode iRetcode;
|
|
564 |
mng_imagedatap pImgbuf;
|
|
565 |
|
|
566 |
#ifdef MNG_SUPPORT_TRACE
|
|
567 |
MNG_TRACE (pData, MNG_FN_CREATE_IMGOBJECT, MNG_LC_START);
|
|
568 |
#endif
|
|
569 |
/* get a buffer */
|
|
570 |
MNG_ALLOC (pData, pImage, sizeof (mng_image));
|
|
571 |
/* now get a new "object buffer" */
|
|
572 |
iRetcode = mng_create_imagedataobject (pData, bConcrete, bViewable,
|
|
573 |
iWidth, iHeight, iBitdepth, iColortype,
|
|
574 |
iCompression, iFilter, iInterlace,
|
|
575 |
&pImgbuf);
|
|
576 |
|
|
577 |
if (iRetcode) /* on error bail out */
|
|
578 |
{
|
|
579 |
MNG_FREEX (pData, pImage, sizeof (mng_image));
|
|
580 |
return iRetcode;
|
|
581 |
}
|
|
582 |
/* fill the appropriate fields */
|
|
583 |
pImage->sHeader.fCleanup = (mng_cleanupobject)mng_free_imageobject;
|
|
584 |
pImage->sHeader.fProcess = MNG_NULL;
|
|
585 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
586 |
pImage->sHeader.iObjsize = sizeof (mng_image);
|
|
587 |
#endif
|
|
588 |
pImage->iId = iId;
|
|
589 |
pImage->bFrozen = MNG_FALSE;
|
|
590 |
pImage->bVisible = bVisible;
|
|
591 |
pImage->bViewable = bViewable;
|
|
592 |
pImage->bValid = (mng_bool)((pData->bDisplaying) &&
|
|
593 |
((pData->bRunning) || (pData->bSearching)) &&
|
|
594 |
(!pData->bFreezing));
|
|
595 |
pImage->iPosx = iPosx;
|
|
596 |
pImage->iPosy = iPosy;
|
|
597 |
pImage->bClipped = bClipped;
|
|
598 |
pImage->iClipl = iClipl;
|
|
599 |
pImage->iClipr = iClipr;
|
|
600 |
pImage->iClipt = iClipt;
|
|
601 |
pImage->iClipb = iClipb;
|
|
602 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
603 |
pImage->iMAGN_MethodX = 0;
|
|
604 |
pImage->iMAGN_MethodY = 0;
|
|
605 |
pImage->iMAGN_MX = 0;
|
|
606 |
pImage->iMAGN_MY = 0;
|
|
607 |
pImage->iMAGN_ML = 0;
|
|
608 |
pImage->iMAGN_MR = 0;
|
|
609 |
pImage->iMAGN_MT = 0;
|
|
610 |
pImage->iMAGN_MB = 0;
|
|
611 |
#endif
|
|
612 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
613 |
pImage->iPastx = 0;
|
|
614 |
pImage->iPasty = 0;
|
|
615 |
#endif
|
|
616 |
pImage->pImgbuf = pImgbuf;
|
|
617 |
|
|
618 |
if (iId) /* only if not object 0 ! */
|
|
619 |
{ /* find previous lower object-id */
|
|
620 |
pPrev = (mng_imagep)pData->pLastimgobj;
|
|
621 |
|
|
622 |
while ((pPrev) && (pPrev->iId > iId))
|
|
623 |
pPrev = (mng_imagep)pPrev->sHeader.pPrev;
|
|
624 |
|
|
625 |
if (pPrev) /* found it ? */
|
|
626 |
{
|
|
627 |
pImage->sHeader.pPrev = pPrev; /* than link it in place */
|
|
628 |
pImage->sHeader.pNext = pPrev->sHeader.pNext;
|
|
629 |
pPrev->sHeader.pNext = pImage;
|
|
630 |
}
|
|
631 |
else /* if not found, it becomes the first ! */
|
|
632 |
{
|
|
633 |
pImage->sHeader.pNext = pData->pFirstimgobj;
|
|
634 |
pData->pFirstimgobj = pImage;
|
|
635 |
}
|
|
636 |
|
|
637 |
pNext = (mng_imagep)pImage->sHeader.pNext;
|
|
638 |
|
|
639 |
if (pNext)
|
|
640 |
pNext->sHeader.pPrev = pImage;
|
|
641 |
else
|
|
642 |
pData->pLastimgobj = pImage;
|
|
643 |
|
|
644 |
}
|
|
645 |
|
|
646 |
*ppObject = pImage; /* and return the new buffer */
|
|
647 |
|
|
648 |
#ifdef MNG_SUPPORT_TRACE
|
|
649 |
MNG_TRACE (pData, MNG_FN_CREATE_IMGOBJECT, MNG_LC_END);
|
|
650 |
#endif
|
|
651 |
|
|
652 |
return MNG_NOERROR; /* okido */
|
|
653 |
}
|
|
654 |
|
|
655 |
/* ************************************************************************** */
|
|
656 |
|
|
657 |
mng_retcode mng_free_imageobject (mng_datap pData,
|
|
658 |
mng_imagep pImage)
|
|
659 |
{
|
|
660 |
mng_retcode iRetcode;
|
|
661 |
mng_imagep pPrev = pImage->sHeader.pPrev;
|
|
662 |
mng_imagep pNext = pImage->sHeader.pNext;
|
|
663 |
mng_imagedatap pImgbuf = pImage->pImgbuf;
|
|
664 |
|
|
665 |
#ifdef MNG_SUPPORT_TRACE
|
|
666 |
MNG_TRACE (pData, MNG_FN_FREE_IMGOBJECT, MNG_LC_START);
|
|
667 |
#endif
|
|
668 |
|
|
669 |
if (pImage->iId) /* not for object 0 */
|
|
670 |
{
|
|
671 |
if (pPrev) /* unlink from the list first ! */
|
|
672 |
pPrev->sHeader.pNext = pImage->sHeader.pNext;
|
|
673 |
else
|
|
674 |
pData->pFirstimgobj = pImage->sHeader.pNext;
|
|
675 |
|
|
676 |
if (pNext)
|
|
677 |
pNext->sHeader.pPrev = pImage->sHeader.pPrev;
|
|
678 |
else
|
|
679 |
pData->pLastimgobj = pImage->sHeader.pPrev;
|
|
680 |
|
|
681 |
}
|
|
682 |
/* unlink the image-data buffer */
|
|
683 |
iRetcode = mng_free_imagedataobject (pData, pImgbuf);
|
|
684 |
/* drop its own buffer */
|
|
685 |
MNG_FREEX (pData, pImage, sizeof (mng_image));
|
|
686 |
|
|
687 |
#ifdef MNG_SUPPORT_TRACE
|
|
688 |
MNG_TRACE (pData, MNG_FN_FREE_IMGOBJECT, MNG_LC_END);
|
|
689 |
#endif
|
|
690 |
|
|
691 |
return iRetcode;
|
|
692 |
}
|
|
693 |
|
|
694 |
/* ************************************************************************** */
|
|
695 |
|
|
696 |
mng_imagep mng_find_imageobject (mng_datap pData,
|
|
697 |
mng_uint16 iId)
|
|
698 |
{
|
|
699 |
mng_imagep pImage = (mng_imagep)pData->pFirstimgobj;
|
|
700 |
|
|
701 |
#ifdef MNG_SUPPORT_TRACE
|
|
702 |
MNG_TRACEX (pData, MNG_FN_FIND_IMGOBJECT, MNG_LC_START);
|
|
703 |
#endif
|
|
704 |
/* look up the right id */
|
|
705 |
while ((pImage) && (pImage->iId != iId))
|
|
706 |
pImage = (mng_imagep)pImage->sHeader.pNext;
|
|
707 |
|
|
708 |
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
|
|
709 |
if ((!pImage) && (pData->eImagetype == mng_it_mpng))
|
|
710 |
pImage = pData->pObjzero;
|
|
711 |
#endif
|
|
712 |
|
|
713 |
#ifdef MNG_SUPPORT_TRACE
|
|
714 |
MNG_TRACEX (pData, MNG_FN_FIND_IMGOBJECT, MNG_LC_END);
|
|
715 |
#endif
|
|
716 |
|
|
717 |
return pImage;
|
|
718 |
}
|
|
719 |
|
|
720 |
/* ************************************************************************** */
|
|
721 |
|
|
722 |
mng_retcode mng_clone_imageobject (mng_datap pData,
|
|
723 |
mng_uint16 iId,
|
|
724 |
mng_bool bPartial,
|
|
725 |
mng_bool bVisible,
|
|
726 |
mng_bool bAbstract,
|
|
727 |
mng_bool bHasloca,
|
|
728 |
mng_uint8 iLocationtype,
|
|
729 |
mng_int32 iLocationx,
|
|
730 |
mng_int32 iLocationy,
|
|
731 |
mng_imagep pSource,
|
|
732 |
mng_imagep *ppClone)
|
|
733 |
{
|
|
734 |
mng_imagep pNew;
|
|
735 |
mng_imagep pPrev, pNext;
|
|
736 |
mng_retcode iRetcode;
|
|
737 |
mng_imagedatap pImgbuf;
|
|
738 |
|
|
739 |
#ifdef MNG_SUPPORT_TRACE
|
|
740 |
MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_START);
|
|
741 |
#endif
|
|
742 |
|
|
743 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
744 |
if ((pSource->iId) && /* needs magnification ? */
|
|
745 |
((pSource->iMAGN_MethodX) || (pSource->iMAGN_MethodY)))
|
|
746 |
{
|
|
747 |
iRetcode = mng_magnify_imageobject (pData, pSource);
|
|
748 |
|
|
749 |
if (iRetcode) /* on error bail out */
|
|
750 |
return iRetcode;
|
|
751 |
}
|
|
752 |
#endif
|
|
753 |
/* get a buffer */
|
|
754 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
755 |
{
|
|
756 |
mng_ptr pTemp;
|
|
757 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_image),
|
|
758 |
(mng_cleanupobject)mng_free_imageobject,
|
|
759 |
MNG_NULL, &pTemp);
|
|
760 |
if (iRetcode)
|
|
761 |
return iRetcode;
|
|
762 |
pNew = (mng_imagep)pTemp;
|
|
763 |
}
|
|
764 |
#else
|
|
765 |
MNG_ALLOC (pData, pNew, sizeof (mng_image));
|
|
766 |
/* fill or copy the appropriate fields */
|
|
767 |
pNew->sHeader.fCleanup = (mng_cleanupobject)mng_free_imageobject;
|
|
768 |
pNew->sHeader.fProcess = MNG_NULL;
|
|
769 |
#endif
|
|
770 |
pNew->iId = iId;
|
|
771 |
pNew->bFrozen = MNG_FALSE;
|
|
772 |
pNew->bVisible = bVisible;
|
|
773 |
pNew->bViewable = pSource->bViewable;
|
|
774 |
pNew->bValid = MNG_TRUE;
|
|
775 |
|
|
776 |
if (bHasloca) /* location info available ? */
|
|
777 |
{
|
|
778 |
if (iLocationtype == 0) /* absolute position ? */
|
|
779 |
{
|
|
780 |
pNew->iPosx = iLocationx;
|
|
781 |
pNew->iPosy = iLocationy;
|
|
782 |
}
|
|
783 |
else /* relative */
|
|
784 |
{
|
|
785 |
pNew->iPosx = pSource->iPosx + iLocationx;
|
|
786 |
pNew->iPosy = pSource->iPosy + iLocationy;
|
|
787 |
}
|
|
788 |
}
|
|
789 |
else /* copy from source */
|
|
790 |
{
|
|
791 |
pNew->iPosx = pSource->iPosx;
|
|
792 |
pNew->iPosy = pSource->iPosy;
|
|
793 |
}
|
|
794 |
/* copy clipping info */
|
|
795 |
pNew->bClipped = pSource->bClipped;
|
|
796 |
pNew->iClipl = pSource->iClipl;
|
|
797 |
pNew->iClipr = pSource->iClipr;
|
|
798 |
pNew->iClipt = pSource->iClipt;
|
|
799 |
pNew->iClipb = pSource->iClipb;
|
|
800 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
801 |
/* copy magnification info */
|
|
802 |
/* pNew->iMAGN_MethodX = pSource->iMAGN_MethodX; LET'S NOT !!!!!!
|
|
803 |
pNew->iMAGN_MethodY = pSource->iMAGN_MethodY;
|
|
804 |
pNew->iMAGN_MX = pSource->iMAGN_MX;
|
|
805 |
pNew->iMAGN_MY = pSource->iMAGN_MY;
|
|
806 |
pNew->iMAGN_ML = pSource->iMAGN_ML;
|
|
807 |
pNew->iMAGN_MR = pSource->iMAGN_MR;
|
|
808 |
pNew->iMAGN_MT = pSource->iMAGN_MT;
|
|
809 |
pNew->iMAGN_MB = pSource->iMAGN_MB; */
|
|
810 |
#endif
|
|
811 |
|
|
812 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
813 |
pNew->iPastx = 0; /* initialize PAST info */
|
|
814 |
pNew->iPasty = 0;
|
|
815 |
#endif
|
|
816 |
|
|
817 |
if (iId) /* not for object 0 */
|
|
818 |
{ /* find previous lower object-id */
|
|
819 |
pPrev = (mng_imagep)pData->pLastimgobj;
|
|
820 |
while ((pPrev) && (pPrev->iId > iId))
|
|
821 |
pPrev = (mng_imagep)pPrev->sHeader.pPrev;
|
|
822 |
|
|
823 |
if (pPrev) /* found it ? */
|
|
824 |
{
|
|
825 |
pNew->sHeader.pPrev = pPrev; /* than link it in place */
|
|
826 |
pNew->sHeader.pNext = pPrev->sHeader.pNext;
|
|
827 |
pPrev->sHeader.pNext = pNew;
|
|
828 |
}
|
|
829 |
else /* if not found, it becomes the first ! */
|
|
830 |
{
|
|
831 |
pNew->sHeader.pNext = pData->pFirstimgobj;
|
|
832 |
pData->pFirstimgobj = pNew;
|
|
833 |
}
|
|
834 |
|
|
835 |
pNext = (mng_imagep)pNew->sHeader.pNext;
|
|
836 |
|
|
837 |
if (pNext)
|
|
838 |
pNext->sHeader.pPrev = pNew;
|
|
839 |
else
|
|
840 |
pData->pLastimgobj = pNew;
|
|
841 |
|
|
842 |
}
|
|
843 |
|
|
844 |
if (bPartial) /* partial clone ? */
|
|
845 |
{
|
|
846 |
pNew->pImgbuf = pSource->pImgbuf; /* use the same object buffer */
|
|
847 |
pNew->pImgbuf->iRefcount++; /* and increase the reference count */
|
|
848 |
}
|
|
849 |
else /* create a full clone ! */
|
|
850 |
{
|
|
851 |
mng_bool bConcrete = MNG_FALSE; /* it's abstract by default (?) */
|
|
852 |
|
|
853 |
if (!bAbstract) /* determine concreteness from source ? */
|
|
854 |
bConcrete = pSource->pImgbuf->bConcrete;
|
|
855 |
/* create a full clone ! */
|
|
856 |
iRetcode = mng_clone_imagedataobject (pData, bConcrete, pSource->pImgbuf, &pImgbuf);
|
|
857 |
|
|
858 |
if (iRetcode) /* on error bail out */
|
|
859 |
{
|
|
860 |
MNG_FREEX (pData, pNew, sizeof (mng_image));
|
|
861 |
return iRetcode;
|
|
862 |
}
|
|
863 |
|
|
864 |
pNew->pImgbuf = pImgbuf; /* and remember it */
|
|
865 |
}
|
|
866 |
|
|
867 |
*ppClone = pNew; /* return it */
|
|
868 |
|
|
869 |
#ifdef MNG_SUPPORT_TRACE
|
|
870 |
MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_END);
|
|
871 |
#endif
|
|
872 |
|
|
873 |
return MNG_NOERROR;
|
|
874 |
}
|
|
875 |
|
|
876 |
/* ************************************************************************** */
|
|
877 |
|
|
878 |
mng_retcode mng_renum_imageobject (mng_datap pData,
|
|
879 |
mng_imagep pSource,
|
|
880 |
mng_uint16 iId,
|
|
881 |
mng_bool bVisible,
|
|
882 |
mng_bool bAbstract,
|
|
883 |
mng_bool bHasloca,
|
|
884 |
mng_uint8 iLocationtype,
|
|
885 |
mng_int32 iLocationx,
|
|
886 |
mng_int32 iLocationy)
|
|
887 |
{
|
|
888 |
mng_imagep pPrev, pNext;
|
|
889 |
|
|
890 |
#ifdef MNG_SUPPORT_TRACE
|
|
891 |
MNG_TRACE (pData, MNG_FN_RENUM_IMGOBJECT, MNG_LC_START);
|
|
892 |
#endif
|
|
893 |
|
|
894 |
pSource->bVisible = bVisible; /* store the new visibility */
|
|
895 |
|
|
896 |
if (bHasloca) /* location info available ? */
|
|
897 |
{
|
|
898 |
if (iLocationtype == 0) /* absolute position ? */
|
|
899 |
{
|
|
900 |
pSource->iPosx = iLocationx;
|
|
901 |
pSource->iPosy = iLocationy;
|
|
902 |
}
|
|
903 |
else /* relative */
|
|
904 |
{
|
|
905 |
pSource->iPosx = pSource->iPosx + iLocationx;
|
|
906 |
pSource->iPosy = pSource->iPosy + iLocationy;
|
|
907 |
}
|
|
908 |
}
|
|
909 |
|
|
910 |
if (iId) /* not for object 0 */
|
|
911 |
{ /* find previous lower object-id */
|
|
912 |
pPrev = (mng_imagep)pData->pLastimgobj;
|
|
913 |
while ((pPrev) && (pPrev->iId > iId))
|
|
914 |
pPrev = (mng_imagep)pPrev->sHeader.pPrev;
|
|
915 |
/* different from current ? */
|
|
916 |
if (pPrev != (mng_imagep)pSource->sHeader.pPrev)
|
|
917 |
{
|
|
918 |
if (pSource->sHeader.pPrev) /* unlink from current position !! */
|
|
919 |
((mng_imagep)pSource->sHeader.pPrev)->sHeader.pNext = pSource->sHeader.pNext;
|
|
920 |
else
|
|
921 |
pData->pFirstimgobj = pSource->sHeader.pNext;
|
|
922 |
|
|
923 |
if (pSource->sHeader.pNext)
|
|
924 |
((mng_imagep)pSource->sHeader.pNext)->sHeader.pPrev = pSource->sHeader.pPrev;
|
|
925 |
else
|
|
926 |
pData->pLastimgobj = pSource->sHeader.pPrev;
|
|
927 |
|
|
928 |
if (pPrev) /* found the previous ? */
|
|
929 |
{ /* than link it in place */
|
|
930 |
pSource->sHeader.pPrev = pPrev;
|
|
931 |
pSource->sHeader.pNext = pPrev->sHeader.pNext;
|
|
932 |
pPrev->sHeader.pNext = pSource;
|
|
933 |
}
|
|
934 |
else /* if not found, it becomes the first ! */
|
|
935 |
{
|
|
936 |
pSource->sHeader.pNext = pData->pFirstimgobj;
|
|
937 |
pData->pFirstimgobj = pSource;
|
|
938 |
}
|
|
939 |
|
|
940 |
pNext = (mng_imagep)pSource->sHeader.pNext;
|
|
941 |
|
|
942 |
if (pNext)
|
|
943 |
pNext->sHeader.pPrev = pSource;
|
|
944 |
else
|
|
945 |
pData->pLastimgobj = pSource;
|
|
946 |
|
|
947 |
}
|
|
948 |
}
|
|
949 |
|
|
950 |
pSource->iId = iId; /* now set the new id! */
|
|
951 |
|
|
952 |
if (bAbstract) /* force it to abstract ? */
|
|
953 |
pSource->pImgbuf->bConcrete = MNG_FALSE;
|
|
954 |
|
|
955 |
#ifdef MNG_SUPPORT_TRACE
|
|
956 |
MNG_TRACE (pData, MNG_FN_RENUM_IMGOBJECT, MNG_LC_END);
|
|
957 |
#endif
|
|
958 |
|
|
959 |
return MNG_NOERROR;
|
|
960 |
}
|
|
961 |
|
|
962 |
/* ************************************************************************** */
|
|
963 |
|
|
964 |
mng_retcode mng_reset_object_details (mng_datap pData,
|
|
965 |
mng_imagep pImage,
|
|
966 |
mng_uint32 iWidth,
|
|
967 |
mng_uint32 iHeight,
|
|
968 |
mng_uint8 iBitdepth,
|
|
969 |
mng_uint8 iColortype,
|
|
970 |
mng_uint8 iCompression,
|
|
971 |
mng_uint8 iFilter,
|
|
972 |
mng_uint8 iInterlace,
|
|
973 |
mng_bool bResetall)
|
|
974 |
{
|
|
975 |
mng_imagedatap pBuf = pImage->pImgbuf;
|
|
976 |
mng_uint32 iSamplesize = 0;
|
|
977 |
mng_uint32 iRowsize;
|
|
978 |
mng_uint32 iImgdatasize;
|
|
979 |
|
|
980 |
#ifdef MNG_SUPPORT_TRACE
|
|
981 |
MNG_TRACE (pData, MNG_FN_RESET_OBJECTDETAILS, MNG_LC_START);
|
|
982 |
#endif
|
|
983 |
|
|
984 |
pBuf->iWidth = iWidth; /* set buffer characteristics */
|
|
985 |
pBuf->iHeight = iHeight;
|
|
986 |
pBuf->iBitdepth = iBitdepth;
|
|
987 |
pBuf->iColortype = iColortype;
|
|
988 |
pBuf->iCompression = iCompression;
|
|
989 |
pBuf->iFilter = iFilter;
|
|
990 |
pBuf->iInterlace = iInterlace;
|
|
991 |
pBuf->bCorrected = MNG_FALSE;
|
|
992 |
pBuf->iAlphabitdepth = 0;
|
|
993 |
/* determine samplesize from color_type/bit_depth */
|
|
994 |
switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */
|
|
995 |
{
|
|
996 |
case 0 : ; /* gray */
|
|
997 |
case 8 : { /* JPEG gray */
|
|
998 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
999 |
if (iBitdepth > 8)
|
|
1000 |
iSamplesize = 2;
|
|
1001 |
else
|
|
1002 |
#endif
|
|
1003 |
iSamplesize = 1;
|
|
1004 |
|
|
1005 |
break;
|
|
1006 |
}
|
|
1007 |
case 2 : ; /* rgb */
|
|
1008 |
case 10 : { /* JPEG rgb */
|
|
1009 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1010 |
if (iBitdepth > 8)
|
|
1011 |
iSamplesize = 6;
|
|
1012 |
else
|
|
1013 |
#endif
|
|
1014 |
iSamplesize = 3;
|
|
1015 |
|
|
1016 |
break;
|
|
1017 |
}
|
|
1018 |
case 3 : { /* indexed */
|
|
1019 |
iSamplesize = 1;
|
|
1020 |
break;
|
|
1021 |
}
|
|
1022 |
case 4 : ; /* gray+alpha */
|
|
1023 |
case 12 : { /* JPEG gray+alpha */
|
|
1024 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1025 |
if (iBitdepth > 8)
|
|
1026 |
iSamplesize = 4;
|
|
1027 |
else
|
|
1028 |
#endif
|
|
1029 |
iSamplesize = 2;
|
|
1030 |
|
|
1031 |
break;
|
|
1032 |
}
|
|
1033 |
case 6 : ; /* rgb+alpha */
|
|
1034 |
case 14 : { /* JPEG rgb+alpha */
|
|
1035 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1036 |
if (iBitdepth > 8)
|
|
1037 |
iSamplesize = 8;
|
|
1038 |
else
|
|
1039 |
#endif
|
|
1040 |
iSamplesize = 4;
|
|
1041 |
|
|
1042 |
break;
|
|
1043 |
}
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
iRowsize = iSamplesize * iWidth;
|
|
1047 |
iImgdatasize = iRowsize * iHeight;
|
|
1048 |
/* buffer size changed ? */
|
|
1049 |
if (iImgdatasize != pBuf->iImgdatasize)
|
|
1050 |
{ /* drop the old one */
|
|
1051 |
MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
1052 |
|
|
1053 |
if (iImgdatasize) /* allocate new sample-buffer ? */
|
|
1054 |
MNG_ALLOC (pData, pBuf->pImgdata, iImgdatasize);
|
|
1055 |
}
|
|
1056 |
else
|
|
1057 |
{
|
|
1058 |
if (iImgdatasize) /* clear old buffer */
|
|
1059 |
{
|
|
1060 |
mng_uint8p pTemp = pBuf->pImgdata;
|
|
1061 |
mng_uint32 iX;
|
|
1062 |
|
|
1063 |
for (iX = 0; iX < (iImgdatasize & (mng_uint32)(~3L)); iX += 4)
|
|
1064 |
{
|
|
1065 |
*((mng_uint32p)pTemp) = 0x00000000l;
|
|
1066 |
pTemp += 4;
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
while (pTemp < (pBuf->pImgdata + iImgdatasize))
|
|
1070 |
{
|
|
1071 |
*pTemp = 0;
|
|
1072 |
pTemp++;
|
|
1073 |
}
|
|
1074 |
}
|
|
1075 |
}
|
|
1076 |
|
|
1077 |
pBuf->iSamplesize = iSamplesize; /* remember new sizes */
|
|
1078 |
pBuf->iRowsize = iRowsize;
|
|
1079 |
pBuf->iImgdatasize = iImgdatasize;
|
|
1080 |
|
|
1081 |
if (!pBuf->iPixelsampledepth) /* set delta sampledepths if empty */
|
|
1082 |
pBuf->iPixelsampledepth = iBitdepth;
|
|
1083 |
if (!pBuf->iAlphasampledepth)
|
|
1084 |
pBuf->iAlphasampledepth = iBitdepth;
|
|
1085 |
/* dimension set and clipping not ? */
|
|
1086 |
if ((iWidth) && (iHeight) && (!pImage->bClipped))
|
|
1087 |
{
|
|
1088 |
pImage->iClipl = 0; /* set clipping to dimension by default */
|
|
1089 |
pImage->iClipr = iWidth;
|
|
1090 |
pImage->iClipt = 0;
|
|
1091 |
pImage->iClipb = iHeight;
|
|
1092 |
}
|
|
1093 |
|
|
1094 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
1095 |
if (pImage->iId) /* reset magnification info ? */
|
|
1096 |
{
|
|
1097 |
pImage->iMAGN_MethodX = 0;
|
|
1098 |
pImage->iMAGN_MethodY = 0;
|
|
1099 |
pImage->iMAGN_MX = 0;
|
|
1100 |
pImage->iMAGN_MY = 0;
|
|
1101 |
pImage->iMAGN_ML = 0;
|
|
1102 |
pImage->iMAGN_MR = 0;
|
|
1103 |
pImage->iMAGN_MT = 0;
|
|
1104 |
pImage->iMAGN_MB = 0;
|
|
1105 |
}
|
|
1106 |
#endif
|
|
1107 |
|
|
1108 |
if (bResetall) /* reset the other characteristics ? */
|
|
1109 |
{
|
|
1110 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
1111 |
pImage->iPastx = 0;
|
|
1112 |
pImage->iPasty = 0;
|
|
1113 |
#endif
|
|
1114 |
|
|
1115 |
pBuf->bHasPLTE = MNG_FALSE;
|
|
1116 |
pBuf->bHasTRNS = MNG_FALSE;
|
|
1117 |
pBuf->bHasGAMA = pData->bHasglobalGAMA;
|
|
1118 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
1119 |
pBuf->bHasCHRM = pData->bHasglobalCHRM;
|
|
1120 |
#endif
|
|
1121 |
pBuf->bHasSRGB = pData->bHasglobalSRGB;
|
|
1122 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
1123 |
pBuf->bHasICCP = pData->bHasglobalICCP;
|
|
1124 |
#endif
|
|
1125 |
#ifndef MNG_SKIPCHUNK_bKGD
|
|
1126 |
pBuf->bHasBKGD = pData->bHasglobalBKGD;
|
|
1127 |
#endif
|
|
1128 |
|
|
1129 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
1130 |
if (pBuf->iProfilesize) /* drop possibly old ICC profile */
|
|
1131 |
{
|
|
1132 |
MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize);
|
|
1133 |
pBuf->iProfilesize = 0;
|
|
1134 |
}
|
|
1135 |
#endif
|
|
1136 |
|
|
1137 |
if (pData->bHasglobalGAMA) /* global gAMA present ? */
|
|
1138 |
pBuf->iGamma = pData->iGlobalGamma;
|
|
1139 |
|
|
1140 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
1141 |
if (pData->bHasglobalCHRM) /* global cHRM present ? */
|
|
1142 |
{
|
|
1143 |
pBuf->iWhitepointx = pData->iGlobalWhitepointx;
|
|
1144 |
pBuf->iWhitepointy = pData->iGlobalWhitepointy;
|
|
1145 |
pBuf->iPrimaryredx = pData->iGlobalPrimaryredx;
|
|
1146 |
pBuf->iPrimaryredy = pData->iGlobalPrimaryredy;
|
|
1147 |
pBuf->iPrimarygreenx = pData->iGlobalPrimarygreenx;
|
|
1148 |
pBuf->iPrimarygreeny = pData->iGlobalPrimarygreeny;
|
|
1149 |
pBuf->iPrimarybluex = pData->iGlobalPrimarybluex;
|
|
1150 |
pBuf->iPrimarybluey = pData->iGlobalPrimarybluey;
|
|
1151 |
}
|
|
1152 |
#endif
|
|
1153 |
|
|
1154 |
if (pData->bHasglobalSRGB) /* global sRGB present ? */
|
|
1155 |
pBuf->iRenderingintent = pData->iGlobalRendintent;
|
|
1156 |
|
|
1157 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
1158 |
if (pData->bHasglobalICCP) /* global iCCP present ? */
|
|
1159 |
{
|
|
1160 |
if (pData->iGlobalProfilesize)
|
|
1161 |
{
|
|
1162 |
MNG_ALLOC (pData, pBuf->pProfile, pData->iGlobalProfilesize);
|
|
1163 |
MNG_COPY (pBuf->pProfile, pData->pGlobalProfile, pData->iGlobalProfilesize);
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
pBuf->iProfilesize = pData->iGlobalProfilesize;
|
|
1167 |
}
|
|
1168 |
#endif
|
|
1169 |
|
|
1170 |
#ifndef MNG_SKIPCHUNK_bKGD
|
|
1171 |
if (pData->bHasglobalBKGD) /* global bKGD present ? */
|
|
1172 |
{
|
|
1173 |
pBuf->iBKGDred = pData->iGlobalBKGDred;
|
|
1174 |
pBuf->iBKGDgreen = pData->iGlobalBKGDgreen;
|
|
1175 |
pBuf->iBKGDblue = pData->iGlobalBKGDblue;
|
|
1176 |
}
|
|
1177 |
#endif
|
|
1178 |
}
|
|
1179 |
|
|
1180 |
#ifdef MNG_SUPPORT_TRACE
|
|
1181 |
MNG_TRACE (pData, MNG_FN_RESET_OBJECTDETAILS, MNG_LC_END);
|
|
1182 |
#endif
|
|
1183 |
|
|
1184 |
return MNG_NOERROR;
|
|
1185 |
}
|
|
1186 |
|
|
1187 |
/* ************************************************************************** */
|
|
1188 |
|
|
1189 |
#if !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN)
|
|
1190 |
mng_retcode mng_promote_imageobject (mng_datap pData,
|
|
1191 |
mng_imagep pImage,
|
|
1192 |
mng_uint8 iBitdepth,
|
|
1193 |
mng_uint8 iColortype,
|
|
1194 |
mng_uint8 iFilltype)
|
|
1195 |
{
|
|
1196 |
mng_retcode iRetcode = MNG_NOERROR;
|
|
1197 |
mng_imagedatap pBuf = pImage->pImgbuf;
|
|
1198 |
mng_uint32 iW = pBuf->iWidth;
|
|
1199 |
mng_uint32 iH = pBuf->iHeight;
|
|
1200 |
mng_uint8p pNewbuf;
|
|
1201 |
mng_uint32 iNewbufsize;
|
|
1202 |
mng_uint32 iNewrowsize;
|
|
1203 |
mng_uint32 iNewsamplesize = pBuf->iSamplesize;
|
|
1204 |
mng_uint32 iY;
|
|
1205 |
mng_uint8 iTempdepth;
|
|
1206 |
|
|
1207 |
#ifdef MNG_SUPPORT_TRACE
|
|
1208 |
MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_START);
|
|
1209 |
#endif
|
|
1210 |
|
|
1211 |
#ifdef MNG_NO_1_2_4BIT_SUPPORT
|
|
1212 |
if (iBitdepth < 8)
|
|
1213 |
iBitdepth=8;
|
|
1214 |
if (pBuf->iBitdepth < 8)
|
|
1215 |
pBuf->iBitdepth=8;
|
|
1216 |
#endif
|
|
1217 |
#ifdef MNG_NO_16BIT_SUPPORT
|
|
1218 |
if (iBitdepth > 8)
|
|
1219 |
iBitdepth=8;
|
|
1220 |
if (pBuf->iBitdepth > 8)
|
|
1221 |
pBuf->iBitdepth=8;
|
|
1222 |
#endif
|
|
1223 |
|
|
1224 |
pData->fPromoterow = MNG_NULL; /* init promotion fields */
|
|
1225 |
pData->fPromBitdepth = MNG_NULL;
|
|
1226 |
pData->iPromColortype = iColortype;
|
|
1227 |
pData->iPromBitdepth = iBitdepth;
|
|
1228 |
pData->iPromFilltype = iFilltype;
|
|
1229 |
|
|
1230 |
if (iBitdepth != pBuf->iBitdepth) /* determine bitdepth promotion */
|
|
1231 |
{
|
|
1232 |
if (pBuf->iColortype == MNG_COLORTYPE_INDEXED)
|
|
1233 |
iTempdepth = 8;
|
|
1234 |
else
|
|
1235 |
iTempdepth = pBuf->iBitdepth;
|
|
1236 |
|
|
1237 |
#ifndef MNG_NO_DELTA_PNG
|
|
1238 |
if (iFilltype == MNG_FILLMETHOD_ZEROFILL)
|
|
1239 |
{
|
|
1240 |
switch (iTempdepth)
|
|
1241 |
{
|
|
1242 |
#ifndef MNG_NO_1_2_4BIT_SUPPORT
|
|
1243 |
case 1 : {
|
|
1244 |
switch (iBitdepth)
|
|
1245 |
{
|
|
1246 |
case 2 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_2; break; }
|
|
1247 |
case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_4; break; }
|
|
1248 |
case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_8; break; }
|
|
1249 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1250 |
case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_16; break; }
|
|
1251 |
#endif
|
|
1252 |
}
|
|
1253 |
break;
|
|
1254 |
}
|
|
1255 |
case 2 : {
|
|
1256 |
switch (iBitdepth)
|
|
1257 |
{
|
|
1258 |
case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_4; break; }
|
|
1259 |
case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_8; break; }
|
|
1260 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1261 |
case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_16; break; }
|
|
1262 |
#endif
|
|
1263 |
}
|
|
1264 |
break;
|
|
1265 |
}
|
|
1266 |
case 4 : {
|
|
1267 |
switch (iBitdepth)
|
|
1268 |
{
|
|
1269 |
case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_4_8; break; }
|
|
1270 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1271 |
case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_4_16; break; }
|
|
1272 |
#endif
|
|
1273 |
}
|
|
1274 |
break;
|
|
1275 |
}
|
|
1276 |
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
|
|
1277 |
case 8 : {
|
|
1278 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1279 |
if (iBitdepth == 16)
|
|
1280 |
pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_8_16;
|
|
1281 |
#endif
|
|
1282 |
break;
|
|
1283 |
}
|
|
1284 |
}
|
|
1285 |
}
|
|
1286 |
else
|
|
1287 |
#endif
|
|
1288 |
{
|
|
1289 |
switch (iTempdepth)
|
|
1290 |
{
|
|
1291 |
#ifndef MNG_NO_1_2_4BIT_SUPPORT
|
|
1292 |
case 1 : {
|
|
1293 |
switch (iBitdepth)
|
|
1294 |
{
|
|
1295 |
case 2 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_2; break; }
|
|
1296 |
case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_4; break; }
|
|
1297 |
case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_8; break; }
|
|
1298 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1299 |
case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_16; break; }
|
|
1300 |
#endif
|
|
1301 |
}
|
|
1302 |
break;
|
|
1303 |
}
|
|
1304 |
case 2 : {
|
|
1305 |
switch (iBitdepth)
|
|
1306 |
{
|
|
1307 |
case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_4; break; }
|
|
1308 |
case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_8; break; }
|
|
1309 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1310 |
case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_16; break; }
|
|
1311 |
#endif
|
|
1312 |
}
|
|
1313 |
break;
|
|
1314 |
}
|
|
1315 |
case 4 : {
|
|
1316 |
switch (iBitdepth)
|
|
1317 |
{
|
|
1318 |
case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_4_8; break; }
|
|
1319 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1320 |
case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_4_16; break; }
|
|
1321 |
#endif
|
|
1322 |
}
|
|
1323 |
break;
|
|
1324 |
}
|
|
1325 |
#endif /* MNG_NO_1_2_4BIT_SUPPORT */
|
|
1326 |
case 8 : {
|
|
1327 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1328 |
if (iBitdepth == 16)
|
|
1329 |
pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_8_16;
|
|
1330 |
#endif
|
|
1331 |
break;
|
|
1332 |
}
|
|
1333 |
}
|
|
1334 |
}
|
|
1335 |
}
|
|
1336 |
/* g -> g */
|
|
1337 |
if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) &&
|
|
1338 |
(iColortype == MNG_COLORTYPE_GRAY))
|
|
1339 |
{
|
|
1340 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1341 |
{
|
|
1342 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1343 |
if (iBitdepth == 16)
|
|
1344 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_g16;
|
|
1345 |
else
|
|
1346 |
#endif
|
|
1347 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_g8;
|
|
1348 |
}
|
|
1349 |
|
|
1350 |
iNewsamplesize = 1;
|
|
1351 |
|
|
1352 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1353 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1354 |
iNewsamplesize = 2;
|
|
1355 |
#endif
|
|
1356 |
}
|
|
1357 |
else /* g -> ga */
|
|
1358 |
if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) &&
|
|
1359 |
(iColortype == MNG_COLORTYPE_GRAYA))
|
|
1360 |
{
|
|
1361 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1362 |
{
|
|
1363 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1364 |
if (iBitdepth == 16)
|
|
1365 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16;
|
|
1366 |
else
|
|
1367 |
#endif
|
|
1368 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8;
|
|
1369 |
}
|
|
1370 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1371 |
else /* source = 16 bits */
|
|
1372 |
pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16;
|
|
1373 |
#endif
|
|
1374 |
|
|
1375 |
iNewsamplesize = 2;
|
|
1376 |
|
|
1377 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1378 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1379 |
iNewsamplesize = 4;
|
|
1380 |
#endif
|
|
1381 |
}
|
|
1382 |
else /* g -> rgb */
|
|
1383 |
if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) &&
|
|
1384 |
(iColortype == MNG_COLORTYPE_RGB))
|
|
1385 |
{
|
|
1386 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1387 |
{
|
|
1388 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1389 |
if (iBitdepth == 16)
|
|
1390 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16;
|
|
1391 |
else
|
|
1392 |
#endif
|
|
1393 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8;
|
|
1394 |
}
|
|
1395 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1396 |
else /* source = 16 bits */
|
|
1397 |
pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16;
|
|
1398 |
#endif
|
|
1399 |
|
|
1400 |
iNewsamplesize = 3;
|
|
1401 |
|
|
1402 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1403 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1404 |
iNewsamplesize = 6;
|
|
1405 |
#endif
|
|
1406 |
}
|
|
1407 |
else /* g -> rgba */
|
|
1408 |
if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) &&
|
|
1409 |
(iColortype == MNG_COLORTYPE_RGBA))
|
|
1410 |
{
|
|
1411 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1412 |
{
|
|
1413 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1414 |
if (iBitdepth == 16)
|
|
1415 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16;
|
|
1416 |
else
|
|
1417 |
#endif
|
|
1418 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8;
|
|
1419 |
}
|
|
1420 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1421 |
else /* source = 16 bits */
|
|
1422 |
pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16;
|
|
1423 |
#endif
|
|
1424 |
|
|
1425 |
iNewsamplesize = 4;
|
|
1426 |
|
|
1427 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1428 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1429 |
iNewsamplesize = 8;
|
|
1430 |
#endif
|
|
1431 |
}
|
|
1432 |
else /* ga -> ga */
|
|
1433 |
if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) &&
|
|
1434 |
(iColortype == MNG_COLORTYPE_GRAYA))
|
|
1435 |
{
|
|
1436 |
iNewsamplesize = 2;
|
|
1437 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1438 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1439 |
if (iBitdepth == 16)
|
|
1440 |
pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16;
|
|
1441 |
if (iBitdepth == 16)
|
|
1442 |
iNewsamplesize = 4;
|
|
1443 |
#endif
|
|
1444 |
}
|
|
1445 |
else /* ga -> rgba */
|
|
1446 |
if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) &&
|
|
1447 |
(iColortype == MNG_COLORTYPE_RGBA))
|
|
1448 |
{
|
|
1449 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1450 |
{
|
|
1451 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1452 |
if (iBitdepth == 16)
|
|
1453 |
pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16;
|
|
1454 |
else
|
|
1455 |
#endif
|
|
1456 |
pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8;
|
|
1457 |
}
|
|
1458 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1459 |
else /* source = 16 bits */
|
|
1460 |
pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16;
|
|
1461 |
#endif
|
|
1462 |
|
|
1463 |
iNewsamplesize = 4;
|
|
1464 |
|
|
1465 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1466 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1467 |
iNewsamplesize = 8;
|
|
1468 |
#endif
|
|
1469 |
}
|
|
1470 |
else /* rgb -> rgb */
|
|
1471 |
if ((pBuf->iColortype == MNG_COLORTYPE_RGB) &&
|
|
1472 |
(iColortype == MNG_COLORTYPE_RGB))
|
|
1473 |
{
|
|
1474 |
iNewsamplesize = 3;
|
|
1475 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1476 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1477 |
if (iBitdepth == 16)
|
|
1478 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16;
|
|
1479 |
if (iBitdepth == 16)
|
|
1480 |
iNewsamplesize = 6;
|
|
1481 |
#endif
|
|
1482 |
}
|
|
1483 |
else /* rgb -> rgba */
|
|
1484 |
if ((pBuf->iColortype == MNG_COLORTYPE_RGB) &&
|
|
1485 |
(iColortype == MNG_COLORTYPE_RGBA))
|
|
1486 |
{
|
|
1487 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1488 |
{
|
|
1489 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1490 |
if (iBitdepth == 16)
|
|
1491 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16;
|
|
1492 |
else
|
|
1493 |
#endif
|
|
1494 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8;
|
|
1495 |
}
|
|
1496 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1497 |
else /* source = 16 bits */
|
|
1498 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16;
|
|
1499 |
#endif
|
|
1500 |
|
|
1501 |
iNewsamplesize = 4;
|
|
1502 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1503 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1504 |
iNewsamplesize = 8;
|
|
1505 |
#endif
|
|
1506 |
}
|
|
1507 |
else /* indexed -> rgb */
|
|
1508 |
if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) &&
|
|
1509 |
(iColortype == MNG_COLORTYPE_RGB))
|
|
1510 |
{
|
|
1511 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1512 |
if (iBitdepth == 16)
|
|
1513 |
pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb16;
|
|
1514 |
else
|
|
1515 |
#endif
|
|
1516 |
pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb8;
|
|
1517 |
|
|
1518 |
iNewsamplesize = 3;
|
|
1519 |
|
|
1520 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1521 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1522 |
iNewsamplesize = 6;
|
|
1523 |
#endif
|
|
1524 |
}
|
|
1525 |
else /* indexed -> rgba */
|
|
1526 |
if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) &&
|
|
1527 |
(iColortype == MNG_COLORTYPE_RGBA))
|
|
1528 |
{
|
|
1529 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1530 |
if (iBitdepth == 16)
|
|
1531 |
pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba16;
|
|
1532 |
else
|
|
1533 |
#endif
|
|
1534 |
pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba8;
|
|
1535 |
|
|
1536 |
iNewsamplesize = 4;
|
|
1537 |
|
|
1538 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1539 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1540 |
iNewsamplesize = 8;
|
|
1541 |
#endif
|
|
1542 |
}
|
|
1543 |
else /* rgba -> rgba */
|
|
1544 |
if ((pBuf->iColortype == MNG_COLORTYPE_RGBA) &&
|
|
1545 |
(iColortype == MNG_COLORTYPE_RGBA))
|
|
1546 |
{
|
|
1547 |
iNewsamplesize = 4;
|
|
1548 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1549 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1550 |
{
|
|
1551 |
if (iBitdepth == 16)
|
|
1552 |
pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16;
|
|
1553 |
}
|
|
1554 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1555 |
iNewsamplesize = 8;
|
|
1556 |
#endif
|
|
1557 |
}
|
|
1558 |
#ifdef MNG_INCLUDE_JNG
|
|
1559 |
else /* JPEG g -> g */
|
|
1560 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) &&
|
|
1561 |
(iColortype == MNG_COLORTYPE_JPEGGRAY))
|
|
1562 |
{
|
|
1563 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1564 |
{
|
|
1565 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1566 |
if (iBitdepth == 16)
|
|
1567 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_g16;
|
|
1568 |
else
|
|
1569 |
#endif
|
|
1570 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_g8;
|
|
1571 |
}
|
|
1572 |
|
|
1573 |
iNewsamplesize = 1;
|
|
1574 |
|
|
1575 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1576 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1577 |
iNewsamplesize = 2;
|
|
1578 |
#endif
|
|
1579 |
}
|
|
1580 |
else /* JPEG g -> ga */
|
|
1581 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) &&
|
|
1582 |
(iColortype == MNG_COLORTYPE_JPEGGRAYA))
|
|
1583 |
{
|
|
1584 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1585 |
{
|
|
1586 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1587 |
if (iBitdepth == 16)
|
|
1588 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16;
|
|
1589 |
else
|
|
1590 |
#endif
|
|
1591 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8;
|
|
1592 |
}
|
|
1593 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1594 |
else /* source = 16 bits */
|
|
1595 |
pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16;
|
|
1596 |
#endif
|
|
1597 |
|
|
1598 |
iNewsamplesize = 2;
|
|
1599 |
|
|
1600 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1601 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1602 |
iNewsamplesize = 4;
|
|
1603 |
#endif
|
|
1604 |
}
|
|
1605 |
else /* JPEG g -> rgb */
|
|
1606 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) &&
|
|
1607 |
(iColortype == MNG_COLORTYPE_JPEGCOLOR))
|
|
1608 |
{
|
|
1609 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1610 |
{
|
|
1611 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1612 |
if (iBitdepth == 16)
|
|
1613 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16;
|
|
1614 |
else
|
|
1615 |
#endif
|
|
1616 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8;
|
|
1617 |
}
|
|
1618 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1619 |
else /* source = 16 bits */
|
|
1620 |
pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16;
|
|
1621 |
#endif
|
|
1622 |
|
|
1623 |
iNewsamplesize = 3;
|
|
1624 |
|
|
1625 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1626 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1627 |
iNewsamplesize = 6;
|
|
1628 |
#endif
|
|
1629 |
}
|
|
1630 |
else /* JPEG g -> rgba */
|
|
1631 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) &&
|
|
1632 |
(iColortype == MNG_COLORTYPE_JPEGCOLORA))
|
|
1633 |
{
|
|
1634 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1635 |
{
|
|
1636 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1637 |
if (iBitdepth == 16)
|
|
1638 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16;
|
|
1639 |
else
|
|
1640 |
#endif
|
|
1641 |
pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8;
|
|
1642 |
}
|
|
1643 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1644 |
else /* source = 16 bits */
|
|
1645 |
pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16;
|
|
1646 |
#endif
|
|
1647 |
|
|
1648 |
iNewsamplesize = 4;
|
|
1649 |
|
|
1650 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1651 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1652 |
iNewsamplesize = 8;
|
|
1653 |
#endif
|
|
1654 |
}
|
|
1655 |
else /* JPEG ga -> ga */
|
|
1656 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) &&
|
|
1657 |
(iColortype == MNG_COLORTYPE_JPEGGRAYA))
|
|
1658 |
{
|
|
1659 |
iNewsamplesize = 2;
|
|
1660 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1661 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1662 |
if (iBitdepth == 16)
|
|
1663 |
pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16;
|
|
1664 |
if (iBitdepth == 16)
|
|
1665 |
iNewsamplesize = 4;
|
|
1666 |
#endif
|
|
1667 |
|
|
1668 |
}
|
|
1669 |
else /* JPEG ga -> rgba */
|
|
1670 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) &&
|
|
1671 |
(iColortype == MNG_COLORTYPE_JPEGCOLORA))
|
|
1672 |
{
|
|
1673 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1674 |
{
|
|
1675 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1676 |
if (iBitdepth == 16)
|
|
1677 |
pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16;
|
|
1678 |
else
|
|
1679 |
#endif
|
|
1680 |
pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8;
|
|
1681 |
}
|
|
1682 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1683 |
else /* source = 16 bits */
|
|
1684 |
pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16;
|
|
1685 |
#endif
|
|
1686 |
|
|
1687 |
iNewsamplesize = 4;
|
|
1688 |
|
|
1689 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1690 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1691 |
iNewsamplesize = 8;
|
|
1692 |
#endif
|
|
1693 |
}
|
|
1694 |
else /* JPEG rgb -> rgb */
|
|
1695 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) &&
|
|
1696 |
(iColortype == MNG_COLORTYPE_JPEGCOLOR))
|
|
1697 |
{
|
|
1698 |
iNewsamplesize = 3;
|
|
1699 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1700 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1701 |
if (iBitdepth == 16)
|
|
1702 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16;
|
|
1703 |
if (iBitdepth == 16)
|
|
1704 |
iNewsamplesize = 6;
|
|
1705 |
#endif
|
|
1706 |
|
|
1707 |
}
|
|
1708 |
else /* JPEG rgb -> rgba */
|
|
1709 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) &&
|
|
1710 |
(iColortype == MNG_COLORTYPE_JPEGCOLORA))
|
|
1711 |
{
|
|
1712 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1713 |
{
|
|
1714 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1715 |
if (iBitdepth == 16)
|
|
1716 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16;
|
|
1717 |
else
|
|
1718 |
#endif
|
|
1719 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8;
|
|
1720 |
}
|
|
1721 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1722 |
else /* source = 16 bits */
|
|
1723 |
pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16;
|
|
1724 |
#endif
|
|
1725 |
|
|
1726 |
iNewsamplesize = 4;
|
|
1727 |
|
|
1728 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1729 |
if (iBitdepth == 16) /* 16-bit wide ? */
|
|
1730 |
iNewsamplesize = 8;
|
|
1731 |
#endif
|
|
1732 |
}
|
|
1733 |
else /* JPEG rgba -> rgba */
|
|
1734 |
if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) &&
|
|
1735 |
(iColortype == MNG_COLORTYPE_JPEGCOLORA))
|
|
1736 |
{
|
|
1737 |
iNewsamplesize = 4;
|
|
1738 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1739 |
if (pBuf->iBitdepth <= 8) /* source <= 8 bits */
|
|
1740 |
if (iBitdepth == 16)
|
|
1741 |
pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16;
|
|
1742 |
if (iBitdepth == 16)
|
|
1743 |
iNewsamplesize = 8;
|
|
1744 |
#endif
|
|
1745 |
}
|
|
1746 |
#endif /* JNG */
|
|
1747 |
|
|
1748 |
/* found a proper promotion ? */
|
|
1749 |
if (pData->fPromoterow)
|
|
1750 |
{
|
|
1751 |
pData->pPromBuf = (mng_ptr)pBuf;
|
|
1752 |
pData->iPromWidth = pBuf->iWidth;
|
|
1753 |
iNewrowsize = iW * iNewsamplesize;
|
|
1754 |
iNewbufsize = iH * iNewrowsize;
|
|
1755 |
|
|
1756 |
MNG_ALLOC (pData, pNewbuf, iNewbufsize);
|
|
1757 |
|
|
1758 |
pData->pPromSrc = (mng_ptr)pBuf->pImgdata;
|
|
1759 |
pData->pPromDst = (mng_ptr)pNewbuf;
|
|
1760 |
iY = 0;
|
|
1761 |
|
|
1762 |
while ((!iRetcode) && (iY < iH))
|
|
1763 |
{
|
|
1764 |
iRetcode = ((mng_promoterow)pData->fPromoterow) (pData);
|
|
1765 |
pData->pPromSrc = (mng_uint8p)pData->pPromSrc + pBuf->iRowsize;
|
|
1766 |
pData->pPromDst = (mng_uint8p)pData->pPromDst + iNewrowsize;
|
|
1767 |
/* pData->pPromSrc = (mng_ptr)((mng_uint32)pData->pPromSrc + pBuf->iRowsize); */
|
|
1768 |
/* pData->pPromDst = (mng_ptr)((mng_uint32)pData->pPromDst + iNewrowsize); */
|
|
1769 |
iY++;
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
1773 |
|
|
1774 |
pBuf->iBitdepth = iBitdepth;
|
|
1775 |
pBuf->iColortype = iColortype;
|
|
1776 |
pBuf->iSamplesize = iNewsamplesize;
|
|
1777 |
pBuf->iRowsize = iNewrowsize;
|
|
1778 |
pBuf->iImgdatasize = iNewbufsize;
|
|
1779 |
pBuf->pImgdata = pNewbuf;
|
|
1780 |
pBuf->bHasPLTE = MNG_FALSE;
|
|
1781 |
pBuf->iPLTEcount = 0;
|
|
1782 |
pBuf->bHasTRNS = MNG_FALSE;
|
|
1783 |
pBuf->iTRNScount = 0;
|
|
1784 |
|
|
1785 |
if (iRetcode) /* on error bail out */
|
|
1786 |
return iRetcode;
|
|
1787 |
}
|
|
1788 |
|
|
1789 |
#ifdef MNG_SUPPORT_TRACE
|
|
1790 |
MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_END);
|
|
1791 |
#endif
|
|
1792 |
|
|
1793 |
return MNG_NOERROR;
|
|
1794 |
}
|
|
1795 |
#endif
|
|
1796 |
|
|
1797 |
/* ************************************************************************** */
|
|
1798 |
|
|
1799 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
1800 |
mng_retcode mng_magnify_imageobject (mng_datap pData,
|
|
1801 |
mng_imagep pImage)
|
|
1802 |
{
|
|
1803 |
mng_uint8p pNewdata;
|
|
1804 |
mng_uint8p pSrcline1;
|
|
1805 |
mng_uint8p pSrcline2;
|
|
1806 |
mng_uint8p pTempline;
|
|
1807 |
mng_uint8p pDstline;
|
|
1808 |
mng_uint32 iNewrowsize;
|
|
1809 |
mng_uint32 iNewsize;
|
|
1810 |
mng_uint32 iY;
|
|
1811 |
mng_int32 iS, iM;
|
|
1812 |
mng_retcode iRetcode;
|
|
1813 |
|
|
1814 |
mng_imagedatap pBuf = pImage->pImgbuf;
|
|
1815 |
mng_uint32 iNewW = pBuf->iWidth;
|
|
1816 |
mng_uint32 iNewH = pBuf->iHeight;
|
|
1817 |
mng_magnify_x fMagnifyX = MNG_NULL;
|
|
1818 |
mng_magnify_y fMagnifyY = MNG_NULL;
|
|
1819 |
|
|
1820 |
#ifdef MNG_SUPPORT_TRACE
|
|
1821 |
MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_START);
|
|
1822 |
#endif
|
|
1823 |
|
|
1824 |
if (pBuf->iColortype == MNG_COLORTYPE_INDEXED) /* indexed color ? */
|
|
1825 |
{ /* concrete buffer ? */
|
|
1826 |
if ((pBuf->bConcrete) && (pImage->iId))
|
|
1827 |
MNG_ERROR (pData, MNG_INVALIDCOLORTYPE);
|
|
1828 |
|
|
1829 |
#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN
|
|
1830 |
if (pBuf->iTRNScount) /* with transparency ? */
|
|
1831 |
iRetcode = mng_promote_imageobject (pData, pImage, 8, 6, 0);
|
|
1832 |
else
|
|
1833 |
iRetcode = mng_promote_imageobject (pData, pImage, 8, 2, 0);
|
|
1834 |
|
|
1835 |
if (iRetcode) /* on error bail out */
|
|
1836 |
return iRetcode;
|
|
1837 |
#endif
|
|
1838 |
}
|
|
1839 |
|
|
1840 |
#ifdef MNG_OPTIMIZE_FOOTPRINT_MAGN
|
|
1841 |
/* Promote everything to RGBA, using fill method 0 (LBR) */
|
|
1842 |
iRetcode = mng_promote_imageobject (pData, pImage, 8, 6, 0);
|
|
1843 |
if (iRetcode) /* on error bail out */
|
|
1844 |
return iRetcode;
|
|
1845 |
#endif
|
|
1846 |
|
|
1847 |
if (pImage->iMAGN_MethodX) /* determine new width */
|
|
1848 |
{
|
|
1849 |
if (pImage->iMAGN_MethodX == 1)
|
|
1850 |
{
|
|
1851 |
iNewW = pImage->iMAGN_ML;
|
|
1852 |
if (pBuf->iWidth > 1)
|
|
1853 |
iNewW = iNewW + pImage->iMAGN_MR;
|
|
1854 |
if (pBuf->iWidth > 2)
|
|
1855 |
iNewW = iNewW + (pBuf->iWidth - 2) * (pImage->iMAGN_MX);
|
|
1856 |
}
|
|
1857 |
else
|
|
1858 |
{
|
|
1859 |
iNewW = pBuf->iWidth + pImage->iMAGN_ML - 1;
|
|
1860 |
if (pBuf->iWidth > 2)
|
|
1861 |
iNewW = iNewW + pImage->iMAGN_MR - 1;
|
|
1862 |
if (pBuf->iWidth > 3)
|
|
1863 |
iNewW = iNewW + (pBuf->iWidth - 3) * (pImage->iMAGN_MX - 1);
|
|
1864 |
}
|
|
1865 |
}
|
|
1866 |
|
|
1867 |
if (pImage->iMAGN_MethodY) /* determine new height */
|
|
1868 |
{
|
|
1869 |
if (pImage->iMAGN_MethodY == 1)
|
|
1870 |
{
|
|
1871 |
iNewH = pImage->iMAGN_MT;
|
|
1872 |
if (pBuf->iHeight > 1)
|
|
1873 |
iNewH = iNewH + pImage->iMAGN_ML;
|
|
1874 |
if (pBuf->iHeight > 2)
|
|
1875 |
iNewH = iNewH + (pBuf->iHeight - 2) * (pImage->iMAGN_MY);
|
|
1876 |
}
|
|
1877 |
else
|
|
1878 |
{
|
|
1879 |
iNewH = pBuf->iHeight + pImage->iMAGN_MT - 1;
|
|
1880 |
if (pBuf->iHeight > 2)
|
|
1881 |
iNewH = iNewH + pImage->iMAGN_MB - 1;
|
|
1882 |
if (pBuf->iHeight > 3)
|
|
1883 |
iNewH = iNewH + (pBuf->iHeight - 3) * (pImage->iMAGN_MY - 1);
|
|
1884 |
}
|
|
1885 |
}
|
|
1886 |
/* get new buffer */
|
|
1887 |
iNewrowsize = iNewW * pBuf->iSamplesize;
|
|
1888 |
iNewsize = iNewH * iNewrowsize;
|
|
1889 |
|
|
1890 |
MNG_ALLOC (pData, pNewdata, iNewsize);
|
|
1891 |
|
|
1892 |
switch (pBuf->iColortype) /* determine magnification routines */
|
|
1893 |
{
|
|
1894 |
#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN
|
|
1895 |
case 0 : ;
|
|
1896 |
case 8 : {
|
|
1897 |
if (pBuf->iBitdepth <= 8)
|
|
1898 |
{
|
|
1899 |
switch (pImage->iMAGN_MethodX)
|
|
1900 |
{
|
|
1901 |
case 1 : { fMagnifyX = mng_magnify_g8_x1; break; }
|
|
1902 |
case 2 : { fMagnifyX = mng_magnify_g8_x2; break; }
|
|
1903 |
case 3 : { fMagnifyX = mng_magnify_g8_x3; break; }
|
|
1904 |
case 4 : { fMagnifyX = mng_magnify_g8_x2; break; }
|
|
1905 |
case 5 : { fMagnifyX = mng_magnify_g8_x3; break; }
|
|
1906 |
}
|
|
1907 |
|
|
1908 |
switch (pImage->iMAGN_MethodY)
|
|
1909 |
{
|
|
1910 |
case 1 : { fMagnifyY = mng_magnify_g8_y1; break; }
|
|
1911 |
case 2 : { fMagnifyY = mng_magnify_g8_y2; break; }
|
|
1912 |
case 3 : { fMagnifyY = mng_magnify_g8_y3; break; }
|
|
1913 |
case 4 : { fMagnifyY = mng_magnify_g8_y2; break; }
|
|
1914 |
case 5 : { fMagnifyY = mng_magnify_g8_y3; break; }
|
|
1915 |
}
|
|
1916 |
}
|
|
1917 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1918 |
else
|
|
1919 |
{
|
|
1920 |
switch (pImage->iMAGN_MethodX)
|
|
1921 |
{
|
|
1922 |
case 1 : { fMagnifyX = mng_magnify_g16_x1; break; }
|
|
1923 |
case 2 : { fMagnifyX = mng_magnify_g16_x2; break; }
|
|
1924 |
case 3 : { fMagnifyX = mng_magnify_g16_x3; break; }
|
|
1925 |
case 4 : { fMagnifyX = mng_magnify_g16_x2; break; }
|
|
1926 |
case 5 : { fMagnifyX = mng_magnify_g16_x3; break; }
|
|
1927 |
}
|
|
1928 |
|
|
1929 |
switch (pImage->iMAGN_MethodY)
|
|
1930 |
{
|
|
1931 |
case 1 : { fMagnifyY = mng_magnify_g16_y1; break; }
|
|
1932 |
case 2 : { fMagnifyY = mng_magnify_g16_y2; break; }
|
|
1933 |
case 3 : { fMagnifyY = mng_magnify_g16_y3; break; }
|
|
1934 |
case 4 : { fMagnifyY = mng_magnify_g16_y2; break; }
|
|
1935 |
case 5 : { fMagnifyY = mng_magnify_g16_y3; break; }
|
|
1936 |
}
|
|
1937 |
}
|
|
1938 |
#endif
|
|
1939 |
|
|
1940 |
break;
|
|
1941 |
}
|
|
1942 |
|
|
1943 |
case 2 : ;
|
|
1944 |
case 10 : {
|
|
1945 |
if (pBuf->iBitdepth <= 8)
|
|
1946 |
{
|
|
1947 |
switch (pImage->iMAGN_MethodX)
|
|
1948 |
{
|
|
1949 |
case 1 : { fMagnifyX = mng_magnify_rgb8_x1; break; }
|
|
1950 |
case 2 : { fMagnifyX = mng_magnify_rgb8_x2; break; }
|
|
1951 |
case 3 : { fMagnifyX = mng_magnify_rgb8_x3; break; }
|
|
1952 |
case 4 : { fMagnifyX = mng_magnify_rgb8_x2; break; }
|
|
1953 |
case 5 : { fMagnifyX = mng_magnify_rgb8_x3; break; }
|
|
1954 |
}
|
|
1955 |
|
|
1956 |
switch (pImage->iMAGN_MethodY)
|
|
1957 |
{
|
|
1958 |
case 1 : { fMagnifyY = mng_magnify_rgb8_y1; break; }
|
|
1959 |
case 2 : { fMagnifyY = mng_magnify_rgb8_y2; break; }
|
|
1960 |
case 3 : { fMagnifyY = mng_magnify_rgb8_y3; break; }
|
|
1961 |
case 4 : { fMagnifyY = mng_magnify_rgb8_y2; break; }
|
|
1962 |
case 5 : { fMagnifyY = mng_magnify_rgb8_y3; break; }
|
|
1963 |
}
|
|
1964 |
}
|
|
1965 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
1966 |
else
|
|
1967 |
{
|
|
1968 |
switch (pImage->iMAGN_MethodX)
|
|
1969 |
{
|
|
1970 |
case 1 : { fMagnifyX = mng_magnify_rgb16_x1; break; }
|
|
1971 |
case 2 : { fMagnifyX = mng_magnify_rgb16_x2; break; }
|
|
1972 |
case 3 : { fMagnifyX = mng_magnify_rgb16_x3; break; }
|
|
1973 |
case 4 : { fMagnifyX = mng_magnify_rgb16_x2; break; }
|
|
1974 |
case 5 : { fMagnifyX = mng_magnify_rgb16_x3; break; }
|
|
1975 |
}
|
|
1976 |
|
|
1977 |
switch (pImage->iMAGN_MethodY)
|
|
1978 |
{
|
|
1979 |
case 1 : { fMagnifyY = mng_magnify_rgb16_y1; break; }
|
|
1980 |
case 2 : { fMagnifyY = mng_magnify_rgb16_y2; break; }
|
|
1981 |
case 3 : { fMagnifyY = mng_magnify_rgb16_y3; break; }
|
|
1982 |
case 4 : { fMagnifyY = mng_magnify_rgb16_y2; break; }
|
|
1983 |
case 5 : { fMagnifyY = mng_magnify_rgb16_y3; break; }
|
|
1984 |
}
|
|
1985 |
}
|
|
1986 |
#endif
|
|
1987 |
|
|
1988 |
break;
|
|
1989 |
}
|
|
1990 |
|
|
1991 |
case 4 : ;
|
|
1992 |
case 12 : {
|
|
1993 |
if (pBuf->iBitdepth <= 8)
|
|
1994 |
{
|
|
1995 |
switch (pImage->iMAGN_MethodX)
|
|
1996 |
{
|
|
1997 |
case 1 : { fMagnifyX = mng_magnify_ga8_x1; break; }
|
|
1998 |
case 2 : { fMagnifyX = mng_magnify_ga8_x2; break; }
|
|
1999 |
case 3 : { fMagnifyX = mng_magnify_ga8_x3; break; }
|
|
2000 |
case 4 : { fMagnifyX = mng_magnify_ga8_x4; break; }
|
|
2001 |
case 5 : { fMagnifyX = mng_magnify_ga8_x5; break; }
|
|
2002 |
}
|
|
2003 |
|
|
2004 |
switch (pImage->iMAGN_MethodY)
|
|
2005 |
{
|
|
2006 |
case 1 : { fMagnifyY = mng_magnify_ga8_y1; break; }
|
|
2007 |
case 2 : { fMagnifyY = mng_magnify_ga8_y2; break; }
|
|
2008 |
case 3 : { fMagnifyY = mng_magnify_ga8_y3; break; }
|
|
2009 |
case 4 : { fMagnifyY = mng_magnify_ga8_y4; break; }
|
|
2010 |
case 5 : { fMagnifyY = mng_magnify_ga8_y5; break; }
|
|
2011 |
}
|
|
2012 |
}
|
|
2013 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
2014 |
else
|
|
2015 |
{
|
|
2016 |
switch (pImage->iMAGN_MethodX)
|
|
2017 |
{
|
|
2018 |
case 1 : { fMagnifyX = mng_magnify_ga16_x1; break; }
|
|
2019 |
case 2 : { fMagnifyX = mng_magnify_ga16_x2; break; }
|
|
2020 |
case 3 : { fMagnifyX = mng_magnify_ga16_x3; break; }
|
|
2021 |
case 4 : { fMagnifyX = mng_magnify_ga16_x4; break; }
|
|
2022 |
case 5 : { fMagnifyX = mng_magnify_ga16_x5; break; }
|
|
2023 |
}
|
|
2024 |
|
|
2025 |
switch (pImage->iMAGN_MethodY)
|
|
2026 |
{
|
|
2027 |
case 1 : { fMagnifyY = mng_magnify_ga16_y1; break; }
|
|
2028 |
case 2 : { fMagnifyY = mng_magnify_ga16_y2; break; }
|
|
2029 |
case 3 : { fMagnifyY = mng_magnify_ga16_y3; break; }
|
|
2030 |
case 4 : { fMagnifyY = mng_magnify_ga16_y4; break; }
|
|
2031 |
case 5 : { fMagnifyY = mng_magnify_ga16_y5; break; }
|
|
2032 |
}
|
|
2033 |
}
|
|
2034 |
#endif
|
|
2035 |
|
|
2036 |
break;
|
|
2037 |
}
|
|
2038 |
#endif
|
|
2039 |
|
|
2040 |
case 6 : ;
|
|
2041 |
case 14 : {
|
|
2042 |
if (pBuf->iBitdepth <= 8)
|
|
2043 |
{
|
|
2044 |
switch (pImage->iMAGN_MethodX)
|
|
2045 |
{
|
|
2046 |
case 1 : { fMagnifyX = mng_magnify_rgba8_x1; break; }
|
|
2047 |
case 2 : { fMagnifyX = mng_magnify_rgba8_x2; break; }
|
|
2048 |
case 3 : { fMagnifyX = mng_magnify_rgba8_x3; break; }
|
|
2049 |
case 4 : { fMagnifyX = mng_magnify_rgba8_x4; break; }
|
|
2050 |
case 5 : { fMagnifyX = mng_magnify_rgba8_x5; break; }
|
|
2051 |
}
|
|
2052 |
|
|
2053 |
switch (pImage->iMAGN_MethodY)
|
|
2054 |
{
|
|
2055 |
case 1 : { fMagnifyY = mng_magnify_rgba8_y1; break; }
|
|
2056 |
case 2 : { fMagnifyY = mng_magnify_rgba8_y2; break; }
|
|
2057 |
case 3 : { fMagnifyY = mng_magnify_rgba8_y3; break; }
|
|
2058 |
case 4 : { fMagnifyY = mng_magnify_rgba8_y4; break; }
|
|
2059 |
case 5 : { fMagnifyY = mng_magnify_rgba8_y5; break; }
|
|
2060 |
}
|
|
2061 |
}
|
|
2062 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
2063 |
#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN
|
|
2064 |
else
|
|
2065 |
{
|
|
2066 |
switch (pImage->iMAGN_MethodX)
|
|
2067 |
{
|
|
2068 |
case 1 : { fMagnifyX = mng_magnify_rgba16_x1; break; }
|
|
2069 |
case 2 : { fMagnifyX = mng_magnify_rgba16_x2; break; }
|
|
2070 |
case 3 : { fMagnifyX = mng_magnify_rgba16_x3; break; }
|
|
2071 |
case 4 : { fMagnifyX = mng_magnify_rgba16_x4; break; }
|
|
2072 |
case 5 : { fMagnifyX = mng_magnify_rgba16_x5; break; }
|
|
2073 |
}
|
|
2074 |
|
|
2075 |
switch (pImage->iMAGN_MethodY)
|
|
2076 |
{
|
|
2077 |
case 1 : { fMagnifyY = mng_magnify_rgba16_y1; break; }
|
|
2078 |
case 2 : { fMagnifyY = mng_magnify_rgba16_y2; break; }
|
|
2079 |
case 3 : { fMagnifyY = mng_magnify_rgba16_y3; break; }
|
|
2080 |
case 4 : { fMagnifyY = mng_magnify_rgba16_y4; break; }
|
|
2081 |
case 5 : { fMagnifyY = mng_magnify_rgba16_y5; break; }
|
|
2082 |
}
|
|
2083 |
}
|
|
2084 |
#endif
|
|
2085 |
#endif
|
|
2086 |
break;
|
|
2087 |
}
|
|
2088 |
}
|
|
2089 |
|
|
2090 |
pSrcline1 = pBuf->pImgdata; /* initialize row-loop variables */
|
|
2091 |
pDstline = pNewdata;
|
|
2092 |
/* allocate temporary row */
|
|
2093 |
MNG_ALLOC (pData, pTempline, iNewrowsize);
|
|
2094 |
|
|
2095 |
for (iY = 0; iY < pBuf->iHeight; iY++)
|
|
2096 |
{
|
|
2097 |
pSrcline2 = pSrcline1 + pBuf->iRowsize;
|
|
2098 |
|
|
2099 |
if (fMagnifyX) /* magnifying in X-direction ? */
|
|
2100 |
{
|
|
2101 |
iRetcode = fMagnifyX (pData, pImage->iMAGN_MX,
|
|
2102 |
pImage->iMAGN_ML, pImage->iMAGN_MR,
|
|
2103 |
pBuf->iWidth, pSrcline1, pDstline);
|
|
2104 |
|
|
2105 |
if (iRetcode) /* on error bail out */
|
|
2106 |
{
|
|
2107 |
MNG_FREEX (pData, pTempline, iNewrowsize);
|
|
2108 |
MNG_FREEX (pData, pNewdata, iNewsize);
|
|
2109 |
return iRetcode;
|
|
2110 |
}
|
|
2111 |
}
|
|
2112 |
else
|
|
2113 |
{
|
|
2114 |
MNG_COPY (pDstline, pSrcline1, iNewrowsize);
|
|
2115 |
}
|
|
2116 |
|
|
2117 |
pDstline += iNewrowsize;
|
|
2118 |
/* magnifying in Y-direction ? */
|
|
2119 |
if ((fMagnifyY) &&
|
|
2120 |
((iY < pBuf->iHeight - 1) || (pBuf->iHeight == 1) || (pImage->iMAGN_MethodY == 1)))
|
|
2121 |
{
|
|
2122 |
if (iY == 0) /* first interval ? */
|
|
2123 |
{
|
|
2124 |
if (pBuf->iHeight == 1) /* single row ? */
|
|
2125 |
pSrcline2 = MNG_NULL;
|
|
2126 |
|
|
2127 |
iM = (mng_int32)pImage->iMAGN_MT;
|
|
2128 |
}
|
|
2129 |
else /* last interval ? */
|
|
2130 |
if (((pImage->iMAGN_MethodY == 1) && (iY == (pBuf->iHeight - 1))) ||
|
|
2131 |
((pImage->iMAGN_MethodY != 1) && (iY == (pBuf->iHeight - 2))) )
|
|
2132 |
iM = (mng_int32)pImage->iMAGN_MB;
|
|
2133 |
else /* middle interval */
|
|
2134 |
iM = (mng_int32)pImage->iMAGN_MY;
|
|
2135 |
|
|
2136 |
for (iS = 1; iS < iM; iS++)
|
|
2137 |
{
|
|
2138 |
iRetcode = fMagnifyY (pData, iS, iM, pBuf->iWidth,
|
|
2139 |
pSrcline1, pSrcline2, pTempline);
|
|
2140 |
|
|
2141 |
if (iRetcode) /* on error bail out */
|
|
2142 |
{
|
|
2143 |
MNG_FREEX (pData, pTempline, iNewrowsize);
|
|
2144 |
MNG_FREEX (pData, pNewdata, iNewsize);
|
|
2145 |
return iRetcode;
|
|
2146 |
}
|
|
2147 |
|
|
2148 |
if (fMagnifyX) /* magnifying in X-direction ? */
|
|
2149 |
{
|
|
2150 |
iRetcode = fMagnifyX (pData, pImage->iMAGN_MX,
|
|
2151 |
pImage->iMAGN_ML, pImage->iMAGN_MR,
|
|
2152 |
pBuf->iWidth, pTempline, pDstline);
|
|
2153 |
|
|
2154 |
if (iRetcode) /* on error bail out */
|
|
2155 |
{
|
|
2156 |
MNG_FREEX (pData, pTempline, iNewrowsize);
|
|
2157 |
MNG_FREEX (pData, pNewdata, iNewsize);
|
|
2158 |
return iRetcode;
|
|
2159 |
}
|
|
2160 |
}
|
|
2161 |
else
|
|
2162 |
{
|
|
2163 |
MNG_COPY (pDstline, pTempline, iNewrowsize);
|
|
2164 |
}
|
|
2165 |
|
|
2166 |
pDstline += iNewrowsize;
|
|
2167 |
}
|
|
2168 |
}
|
|
2169 |
|
|
2170 |
pSrcline1 += pBuf->iRowsize;
|
|
2171 |
}
|
|
2172 |
/* drop temporary row */
|
|
2173 |
MNG_FREEX (pData, pTempline, iNewrowsize);
|
|
2174 |
/* drop old pixel-data */
|
|
2175 |
MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
2176 |
|
|
2177 |
pBuf->pImgdata = pNewdata; /* save new buffer dimensions */
|
|
2178 |
pBuf->iRowsize = iNewrowsize;
|
|
2179 |
pBuf->iImgdatasize = iNewsize;
|
|
2180 |
pBuf->iWidth = iNewW;
|
|
2181 |
pBuf->iHeight = iNewH;
|
|
2182 |
|
|
2183 |
if (pImage->iId) /* real object ? */
|
|
2184 |
{
|
|
2185 |
pImage->iMAGN_MethodX = 0; /* it's done; don't do it again !!! */
|
|
2186 |
pImage->iMAGN_MethodY = 0;
|
|
2187 |
pImage->iMAGN_MX = 0;
|
|
2188 |
pImage->iMAGN_MY = 0;
|
|
2189 |
pImage->iMAGN_ML = 0;
|
|
2190 |
pImage->iMAGN_MR = 0;
|
|
2191 |
pImage->iMAGN_MT = 0;
|
|
2192 |
pImage->iMAGN_MB = 0;
|
|
2193 |
}
|
|
2194 |
|
|
2195 |
#ifdef MNG_SUPPORT_TRACE
|
|
2196 |
MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_END);
|
|
2197 |
#endif
|
|
2198 |
|
|
2199 |
return MNG_NOERROR;
|
|
2200 |
}
|
|
2201 |
#endif
|
|
2202 |
|
|
2203 |
/* ************************************************************************** */
|
|
2204 |
|
|
2205 |
mng_retcode mng_colorcorrect_object (mng_datap pData,
|
|
2206 |
mng_imagep pImage)
|
|
2207 |
{
|
|
2208 |
mng_imagedatap pBuf = pImage->pImgbuf;
|
|
2209 |
mng_retcode iRetcode;
|
|
2210 |
mng_uint32 iY;
|
|
2211 |
|
|
2212 |
#ifdef MNG_SUPPORT_TRACE
|
|
2213 |
MNG_TRACE (pData, MNG_FN_COLORCORRECT_OBJECT, MNG_LC_START);
|
|
2214 |
#endif
|
|
2215 |
|
|
2216 |
#ifdef MNG_INCLUDE_JNG
|
|
2217 |
if ((pBuf->iBitdepth < 8) || /* we need 8- or 16-bit RGBA !!! */
|
|
2218 |
((pBuf->iColortype != MNG_COLORTYPE_RGBA ) &&
|
|
2219 |
(pBuf->iColortype != MNG_COLORTYPE_JPEGCOLORA) ))
|
|
2220 |
#else
|
|
2221 |
if (pBuf->iBitdepth < 8) /* we need 8- or 16-bit RGBA !!! */
|
|
2222 |
#endif
|
|
2223 |
MNG_ERROR (pData, MNG_OBJNOTABSTRACT);
|
|
2224 |
|
|
2225 |
if (!pBuf->bCorrected) /* only if not already done ! */
|
|
2226 |
{ /* so the row routines now to find it */
|
|
2227 |
pData->pRetrieveobj = (mng_objectp)pImage;
|
|
2228 |
pData->pStoreobj = (mng_objectp)pImage;
|
|
2229 |
pData->pStorebuf = (mng_objectp)pImage->pImgbuf;
|
|
2230 |
|
|
2231 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
2232 |
if (pBuf->iBitdepth > 8)
|
|
2233 |
{
|
|
2234 |
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16;
|
|
2235 |
pData->fStorerow = (mng_fptr)mng_store_rgba16;
|
|
2236 |
}
|
|
2237 |
else
|
|
2238 |
#endif
|
|
2239 |
{
|
|
2240 |
pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8;
|
|
2241 |
pData->fStorerow = (mng_fptr)mng_store_rgba8;
|
|
2242 |
}
|
|
2243 |
|
|
2244 |
pData->bIsOpaque = MNG_FALSE;
|
|
2245 |
|
|
2246 |
pData->iPass = -1; /* these are the object's dimensions now */
|
|
2247 |
pData->iRow = 0;
|
|
2248 |
pData->iRowinc = 1;
|
|
2249 |
pData->iCol = 0;
|
|
2250 |
pData->iColinc = 1;
|
|
2251 |
pData->iRowsamples = pBuf->iWidth;
|
|
2252 |
pData->iRowsize = pData->iRowsamples << 2;
|
|
2253 |
pData->iPixelofs = 0;
|
|
2254 |
pData->bIsRGBA16 = MNG_FALSE;
|
|
2255 |
/* adjust for 16-bit object ? */
|
|
2256 |
#ifndef MNG_NO_16BIT_SUPPORT
|
|
2257 |
if (pBuf->iBitdepth > 8)
|
|
2258 |
{
|
|
2259 |
pData->bIsRGBA16 = MNG_TRUE;
|
|
2260 |
pData->iRowsize = pData->iRowsamples << 3;
|
|
2261 |
}
|
|
2262 |
#endif
|
|
2263 |
|
|
2264 |
pData->fCorrectrow = MNG_NULL; /* default no color-correction */
|
|
2265 |
|
|
2266 |
#ifdef MNG_NO_CMS
|
|
2267 |
iRetcode = MNG_NOERROR;
|
|
2268 |
#else
|
|
2269 |
#if defined(MNG_FULL_CMS) /* determine color-management routine */
|
|
2270 |
iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
|
|
2271 |
#elif defined(MNG_GAMMA_ONLY)
|
|
2272 |
iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
|
|
2273 |
#elif defined(MNG_APP_CMS)
|
|
2274 |
iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE);
|
|
2275 |
#endif
|
|
2276 |
if (iRetcode) /* on error bail out */
|
|
2277 |
return iRetcode;
|
|
2278 |
#endif /* MNG_NO_CMS */
|
|
2279 |
|
|
2280 |
if (pData->fCorrectrow) /* really correct something ? */
|
|
2281 |
{ /* get a temporary row-buffer */
|
|
2282 |
MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize);
|
|
2283 |
|
|
2284 |
pData->pWorkrow = pData->pRGBArow;
|
|
2285 |
iY = 0; /* start from the top */
|
|
2286 |
|
|
2287 |
while ((!iRetcode) && (iY < pBuf->iHeight))
|
|
2288 |
{ /* get a row */
|
|
2289 |
iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);
|
|
2290 |
|
|
2291 |
if (!iRetcode) /* color correct it */
|
|
2292 |
iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);
|
|
2293 |
|
|
2294 |
if (!iRetcode) /* store it back ! */
|
|
2295 |
iRetcode = ((mng_storerow)pData->fStorerow) (pData);
|
|
2296 |
|
|
2297 |
if (!iRetcode) /* adjust variables for next row */
|
|
2298 |
iRetcode = mng_next_row (pData);
|
|
2299 |
|
|
2300 |
iY++; /* and next line */
|
|
2301 |
}
|
|
2302 |
/* drop the temporary row-buffer */
|
|
2303 |
MNG_FREEX (pData, pData->pRGBArow, pData->iRowsize);
|
|
2304 |
|
|
2305 |
if (iRetcode) /* on error bail out */
|
|
2306 |
return iRetcode;
|
|
2307 |
|
|
2308 |
#if defined(MNG_FULL_CMS) /* cleanup cms stuff */
|
|
2309 |
iRetcode = mng_clear_cms (pData);
|
|
2310 |
|
|
2311 |
if (iRetcode) /* on error bail out */
|
|
2312 |
return iRetcode;
|
|
2313 |
#endif
|
|
2314 |
}
|
|
2315 |
|
|
2316 |
pBuf->bCorrected = MNG_TRUE; /* let's not go through that again ! */
|
|
2317 |
}
|
|
2318 |
|
|
2319 |
#ifdef MNG_SUPPORT_TRACE
|
|
2320 |
MNG_TRACE (pData, MNG_FN_COLORCORRECT_OBJECT, MNG_LC_END);
|
|
2321 |
#endif
|
|
2322 |
|
|
2323 |
return MNG_NOERROR;
|
|
2324 |
}
|
|
2325 |
|
|
2326 |
/* ************************************************************************** */
|
|
2327 |
/* * * */
|
|
2328 |
/* * Animation-object routines * */
|
|
2329 |
/* * * */
|
|
2330 |
/* * these handle the animation objects used to re-run parts of a MNG. * */
|
|
2331 |
/* * eg. during LOOP or TERM processing * */
|
|
2332 |
/* * * */
|
|
2333 |
/* ************************************************************************** */
|
|
2334 |
|
|
2335 |
void mng_add_ani_object (mng_datap pData,
|
|
2336 |
mng_object_headerp pObject)
|
|
2337 |
{
|
|
2338 |
mng_object_headerp pLast = (mng_object_headerp)pData->pLastaniobj;
|
|
2339 |
|
|
2340 |
if (pLast) /* link it as last in the chain */
|
|
2341 |
{
|
|
2342 |
pObject->pPrev = pLast;
|
|
2343 |
pLast->pNext = pObject;
|
|
2344 |
}
|
|
2345 |
else
|
|
2346 |
{
|
|
2347 |
pObject->pPrev = MNG_NULL; /* be on the safe side */
|
|
2348 |
pData->pFirstaniobj = pObject;
|
|
2349 |
}
|
|
2350 |
|
|
2351 |
pObject->pNext = MNG_NULL; /* be on the safe side */
|
|
2352 |
pData->pLastaniobj = pObject;
|
|
2353 |
/* keep track for jumping */
|
|
2354 |
pObject->iFramenr = pData->iFrameseq;
|
|
2355 |
pObject->iLayernr = pData->iLayerseq;
|
|
2356 |
pObject->iPlaytime = pData->iFrametime;
|
|
2357 |
/* save restart object ? */
|
|
2358 |
if ((pData->bDisplaying) && (!pData->bRunning) && (!pData->pCurraniobj))
|
|
2359 |
pData->pCurraniobj = pObject;
|
|
2360 |
|
|
2361 |
return;
|
|
2362 |
}
|
|
2363 |
|
|
2364 |
/* ************************************************************************** */
|
|
2365 |
/* ************************************************************************** */
|
|
2366 |
|
|
2367 |
mng_retcode mng_create_ani_image (mng_datap pData)
|
|
2368 |
{
|
|
2369 |
mng_ani_imagep pImage;
|
|
2370 |
mng_imagep pCurrent;
|
|
2371 |
mng_retcode iRetcode;
|
|
2372 |
|
|
2373 |
#ifdef MNG_SUPPORT_TRACE
|
|
2374 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_START);
|
|
2375 |
#endif
|
|
2376 |
|
|
2377 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
2378 |
{
|
|
2379 |
#ifndef MNG_NO_DELTA_PNG
|
|
2380 |
if (pData->bHasDHDR) /* processing delta-image ? */
|
|
2381 |
pCurrent = (mng_imagep)pData->pObjzero;
|
|
2382 |
else /* get the current object */
|
|
2383 |
#endif
|
|
2384 |
pCurrent = (mng_imagep)pData->pCurrentobj;
|
|
2385 |
|
|
2386 |
if (!pCurrent) /* otherwise object 0 */
|
|
2387 |
pCurrent = (mng_imagep)pData->pObjzero;
|
|
2388 |
/* now just clone the object !!! */
|
|
2389 |
iRetcode = mng_clone_imageobject (pData, 0, MNG_FALSE, pCurrent->bVisible,
|
|
2390 |
MNG_FALSE, MNG_FALSE, 0, 0, 0, pCurrent,
|
|
2391 |
&pImage);
|
|
2392 |
|
|
2393 |
if (iRetcode) /* on error bail out */
|
|
2394 |
return iRetcode;
|
|
2395 |
|
|
2396 |
pImage->sHeader.fCleanup = mng_free_ani_image;
|
|
2397 |
pImage->sHeader.fProcess = mng_process_ani_image;
|
|
2398 |
|
|
2399 |
mng_add_ani_object (pData, (mng_object_headerp)pImage);
|
|
2400 |
}
|
|
2401 |
|
|
2402 |
#ifdef MNG_SUPPORT_TRACE
|
|
2403 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_END);
|
|
2404 |
#endif
|
|
2405 |
|
|
2406 |
return MNG_NOERROR; /* okido */
|
|
2407 |
}
|
|
2408 |
|
|
2409 |
/* ************************************************************************** */
|
|
2410 |
|
|
2411 |
mng_retcode mng_free_ani_image (mng_datap pData,
|
|
2412 |
mng_objectp pObject)
|
|
2413 |
{
|
|
2414 |
mng_ani_imagep pImage = (mng_ani_imagep)pObject;
|
|
2415 |
mng_imagedatap pImgbuf = pImage->pImgbuf;
|
|
2416 |
mng_retcode iRetcode;
|
|
2417 |
|
|
2418 |
#ifdef MNG_SUPPORT_TRACE
|
|
2419 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_IMAGE, MNG_LC_START);
|
|
2420 |
#endif
|
|
2421 |
/* unlink the image-data buffer */
|
|
2422 |
iRetcode = mng_free_imagedataobject (pData, pImgbuf);
|
|
2423 |
/* drop its own buffer */
|
|
2424 |
MNG_FREEX (pData, pImage, sizeof (mng_ani_image));
|
|
2425 |
|
|
2426 |
#ifdef MNG_SUPPORT_TRACE
|
|
2427 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_IMAGE, MNG_LC_END);
|
|
2428 |
#endif
|
|
2429 |
|
|
2430 |
return iRetcode;
|
|
2431 |
}
|
|
2432 |
|
|
2433 |
/* ************************************************************************** */
|
|
2434 |
|
|
2435 |
mng_retcode mng_process_ani_image (mng_datap pData,
|
|
2436 |
mng_objectp pObject)
|
|
2437 |
{
|
|
2438 |
mng_retcode iRetcode = MNG_NOERROR;
|
|
2439 |
mng_ani_imagep pImage = (mng_imagep)pObject;
|
|
2440 |
|
|
2441 |
#ifdef MNG_SUPPORT_TRACE
|
|
2442 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_START);
|
|
2443 |
#endif
|
|
2444 |
|
|
2445 |
#ifndef MNG_NO_DELTA_PNG
|
|
2446 |
if (pData->bHasDHDR) /* processing delta-image ? */
|
|
2447 |
{
|
|
2448 |
mng_imagep pDelta = (mng_imagep)pData->pDeltaImage;
|
|
2449 |
|
|
2450 |
if (!pData->iBreakpoint) /* only execute if not broken before */
|
|
2451 |
{ /* make sure to process pixels as well */
|
|
2452 |
pData->bDeltaimmediate = MNG_FALSE;
|
|
2453 |
/* execute the delta process */
|
|
2454 |
iRetcode = mng_execute_delta_image (pData, pDelta, (mng_imagep)pObject);
|
|
2455 |
|
|
2456 |
if (iRetcode) /* on error bail out */
|
|
2457 |
return iRetcode;
|
|
2458 |
}
|
|
2459 |
/* now go and shoot it off (if required) */
|
|
2460 |
if ((pDelta->bVisible) && (pDelta->bViewable))
|
|
2461 |
iRetcode = mng_display_image (pData, pDelta, MNG_FALSE);
|
|
2462 |
|
|
2463 |
if (!pData->bTimerset)
|
|
2464 |
pData->bHasDHDR = MNG_FALSE; /* this image signifies IEND !! */
|
|
2465 |
|
|
2466 |
}
|
|
2467 |
else
|
|
2468 |
#endif
|
|
2469 |
if (pData->pCurrentobj) /* active object ? */
|
|
2470 |
{
|
|
2471 |
mng_imagep pCurrent = (mng_imagep)pData->pCurrentobj;
|
|
2472 |
mng_imagedatap pBuf = pCurrent->pImgbuf;
|
|
2473 |
|
|
2474 |
if (!pData->iBreakpoint) /* don't copy it again ! */
|
|
2475 |
{
|
|
2476 |
if (pBuf->iImgdatasize) /* buffer present in active object ? */
|
|
2477 |
/* then drop it */
|
|
2478 |
MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
2479 |
|
|
2480 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
2481 |
if (pBuf->iProfilesize) /* iCCP profile present ? */
|
|
2482 |
/* then drop it */
|
|
2483 |
MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize);
|
|
2484 |
#endif
|
|
2485 |
/* now blatently copy the animation buffer */
|
|
2486 |
MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata));
|
|
2487 |
/* copy viewability */
|
|
2488 |
pCurrent->bViewable = pImage->bViewable;
|
|
2489 |
|
|
2490 |
if (pBuf->iImgdatasize) /* sample buffer present ? */
|
|
2491 |
{ /* then make a copy */
|
|
2492 |
MNG_ALLOC (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
2493 |
MNG_COPY (pBuf->pImgdata, pImage->pImgbuf->pImgdata, pBuf->iImgdatasize);
|
|
2494 |
}
|
|
2495 |
|
|
2496 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
2497 |
if (pBuf->iProfilesize) /* iCCP profile present ? */
|
|
2498 |
{ /* then make a copy */
|
|
2499 |
MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize);
|
|
2500 |
MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize);
|
|
2501 |
}
|
|
2502 |
#endif
|
|
2503 |
}
|
|
2504 |
/* now go and shoot it off (if required) */
|
|
2505 |
if ((pCurrent->bVisible) && (pCurrent->bViewable))
|
|
2506 |
iRetcode = mng_display_image (pData, pCurrent, MNG_FALSE);
|
|
2507 |
}
|
|
2508 |
else
|
|
2509 |
{
|
|
2510 |
mng_imagep pObjzero = (mng_imagep)pData->pObjzero;
|
|
2511 |
mng_imagedatap pBuf = pObjzero->pImgbuf;
|
|
2512 |
|
|
2513 |
if (!pData->iBreakpoint) /* don't copy it again ! */
|
|
2514 |
{
|
|
2515 |
if (pBuf->iImgdatasize) /* buffer present in active object ? */
|
|
2516 |
/* then drop it */
|
|
2517 |
MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
2518 |
|
|
2519 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
2520 |
if (pBuf->iProfilesize) /* iCCP profile present ? */
|
|
2521 |
/* then drop it */
|
|
2522 |
MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize);
|
|
2523 |
#endif
|
|
2524 |
/* now blatently copy the animation buffer */
|
|
2525 |
MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata));
|
|
2526 |
/* copy viewability */
|
|
2527 |
pObjzero->bViewable = pImage->bViewable;
|
|
2528 |
|
|
2529 |
if (pBuf->iImgdatasize) /* sample buffer present ? */
|
|
2530 |
{ /* then make a copy */
|
|
2531 |
MNG_ALLOC (pData, pBuf->pImgdata, pBuf->iImgdatasize);
|
|
2532 |
MNG_COPY (pBuf->pImgdata, pImage->pImgbuf->pImgdata, pBuf->iImgdatasize);
|
|
2533 |
}
|
|
2534 |
|
|
2535 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
2536 |
if (pBuf->iProfilesize) /* iCCP profile present ? */
|
|
2537 |
{ /* then make a copy */
|
|
2538 |
MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize);
|
|
2539 |
MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize);
|
|
2540 |
}
|
|
2541 |
#endif
|
|
2542 |
}
|
|
2543 |
/* now go and show it */
|
|
2544 |
iRetcode = mng_display_image (pData, pObjzero, MNG_FALSE);
|
|
2545 |
}
|
|
2546 |
|
|
2547 |
if (!iRetcode) /* all's well ? */
|
|
2548 |
{
|
|
2549 |
if (pData->bTimerset) /* timer break ? */
|
|
2550 |
pData->iBreakpoint = 99; /* fictive number; no more processing needed! */
|
|
2551 |
else
|
|
2552 |
pData->iBreakpoint = 0; /* else clear it */
|
|
2553 |
}
|
|
2554 |
|
|
2555 |
#ifdef MNG_SUPPORT_TRACE
|
|
2556 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_END);
|
|
2557 |
#endif
|
|
2558 |
|
|
2559 |
return iRetcode;
|
|
2560 |
}
|
|
2561 |
|
|
2562 |
/* ************************************************************************** */
|
|
2563 |
/* ************************************************************************** */
|
|
2564 |
|
|
2565 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2566 |
mng_retcode mng_create_ani_plte (mng_datap pData,
|
|
2567 |
mng_uint32 iEntrycount,
|
|
2568 |
mng_palette8ep paEntries)
|
|
2569 |
#else
|
|
2570 |
mng_retcode mng_create_ani_plte (mng_datap pData)
|
|
2571 |
#endif
|
|
2572 |
{
|
|
2573 |
mng_ani_pltep pPLTE;
|
|
2574 |
|
|
2575 |
#ifdef MNG_SUPPORT_TRACE
|
|
2576 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PLTE, MNG_LC_START);
|
|
2577 |
#endif
|
|
2578 |
|
|
2579 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
2580 |
{
|
|
2581 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
2582 |
mng_ptr pTemp;
|
|
2583 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_plte),
|
|
2584 |
mng_free_obj_general,
|
|
2585 |
mng_process_ani_plte,
|
|
2586 |
&pTemp);
|
|
2587 |
if (iRetcode)
|
|
2588 |
return iRetcode;
|
|
2589 |
pPLTE = (mng_ani_pltep)pTemp;
|
|
2590 |
#else
|
|
2591 |
MNG_ALLOC (pData, pPLTE, sizeof (mng_ani_plte));
|
|
2592 |
|
|
2593 |
pPLTE->sHeader.fCleanup = mng_free_ani_plte;
|
|
2594 |
pPLTE->sHeader.fProcess = mng_process_ani_plte;
|
|
2595 |
#endif
|
|
2596 |
|
|
2597 |
mng_add_ani_object (pData, (mng_object_headerp)pPLTE);
|
|
2598 |
|
|
2599 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2600 |
pPLTE->iEntrycount = iEntrycount;
|
|
2601 |
MNG_COPY (pPLTE->aEntries, paEntries, sizeof (pPLTE->aEntries));
|
|
2602 |
#else
|
|
2603 |
pPLTE->iEntrycount = pData->iGlobalPLTEcount;
|
|
2604 |
MNG_COPY (pPLTE->aEntries, pData->aGlobalPLTEentries, sizeof (pPLTE->aEntries));
|
|
2605 |
#endif
|
|
2606 |
}
|
|
2607 |
|
|
2608 |
#ifdef MNG_SUPPORT_TRACE
|
|
2609 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PLTE, MNG_LC_END);
|
|
2610 |
#endif
|
|
2611 |
|
|
2612 |
return MNG_NOERROR;
|
|
2613 |
}
|
|
2614 |
|
|
2615 |
/* ************************************************************************** */
|
|
2616 |
|
|
2617 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
2618 |
mng_retcode mng_free_ani_plte (mng_datap pData,
|
|
2619 |
mng_objectp pObject)
|
|
2620 |
{
|
|
2621 |
#ifdef MNG_SUPPORT_TRACE
|
|
2622 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PLTE, MNG_LC_START);
|
|
2623 |
#endif
|
|
2624 |
|
|
2625 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_plte));
|
|
2626 |
|
|
2627 |
#ifdef MNG_SUPPORT_TRACE
|
|
2628 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PLTE, MNG_LC_END);
|
|
2629 |
#endif
|
|
2630 |
|
|
2631 |
return MNG_NOERROR;
|
|
2632 |
}
|
|
2633 |
#endif
|
|
2634 |
|
|
2635 |
/* ************************************************************************** */
|
|
2636 |
|
|
2637 |
mng_retcode mng_process_ani_plte (mng_datap pData,
|
|
2638 |
mng_objectp pObject)
|
|
2639 |
{
|
|
2640 |
mng_ani_pltep pPLTE = (mng_ani_pltep)pObject;
|
|
2641 |
|
|
2642 |
#ifdef MNG_SUPPORT_TRACE
|
|
2643 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PLTE, MNG_LC_START);
|
|
2644 |
#endif
|
|
2645 |
|
|
2646 |
pData->bHasglobalPLTE = MNG_TRUE;
|
|
2647 |
pData->iGlobalPLTEcount = pPLTE->iEntrycount;
|
|
2648 |
|
|
2649 |
MNG_COPY (pData->aGlobalPLTEentries, pPLTE->aEntries, sizeof (pPLTE->aEntries));
|
|
2650 |
|
|
2651 |
#ifdef MNG_SUPPORT_TRACE
|
|
2652 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PLTE, MNG_LC_END);
|
|
2653 |
#endif
|
|
2654 |
|
|
2655 |
return MNG_NOERROR;
|
|
2656 |
}
|
|
2657 |
|
|
2658 |
/* ************************************************************************** */
|
|
2659 |
/* ************************************************************************** */
|
|
2660 |
|
|
2661 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2662 |
mng_retcode mng_create_ani_trns (mng_datap pData,
|
|
2663 |
mng_uint32 iRawlen,
|
|
2664 |
mng_uint8p pRawdata)
|
|
2665 |
#else
|
|
2666 |
mng_retcode mng_create_ani_trns (mng_datap pData)
|
|
2667 |
#endif
|
|
2668 |
{
|
|
2669 |
mng_ani_trnsp pTRNS;
|
|
2670 |
|
|
2671 |
#ifdef MNG_SUPPORT_TRACE
|
|
2672 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_TRNS, MNG_LC_START);
|
|
2673 |
#endif
|
|
2674 |
|
|
2675 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
2676 |
{
|
|
2677 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
2678 |
mng_ptr pTemp;
|
|
2679 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_trns),
|
|
2680 |
mng_free_obj_general,
|
|
2681 |
mng_process_ani_trns,
|
|
2682 |
&pTemp);
|
|
2683 |
if (iRetcode)
|
|
2684 |
return iRetcode;
|
|
2685 |
pTRNS = (mng_ani_trnsp)pTemp;
|
|
2686 |
#else
|
|
2687 |
MNG_ALLOC (pData, pTRNS, sizeof (mng_ani_trns));
|
|
2688 |
|
|
2689 |
pTRNS->sHeader.fCleanup = mng_free_ani_trns;
|
|
2690 |
pTRNS->sHeader.fProcess = mng_process_ani_trns;
|
|
2691 |
#endif
|
|
2692 |
|
|
2693 |
mng_add_ani_object (pData, (mng_object_headerp)pTRNS);
|
|
2694 |
|
|
2695 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2696 |
pTRNS->iRawlen = iRawlen;
|
|
2697 |
MNG_COPY (pTRNS->aRawdata, pRawdata, sizeof (pTRNS->aRawdata));
|
|
2698 |
#else
|
|
2699 |
pTRNS->iRawlen = pData->iGlobalTRNSrawlen;
|
|
2700 |
MNG_COPY (pTRNS->aRawdata, pData->aGlobalTRNSrawdata, sizeof (pTRNS->aRawdata));
|
|
2701 |
#endif
|
|
2702 |
}
|
|
2703 |
|
|
2704 |
#ifdef MNG_SUPPORT_TRACE
|
|
2705 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_TRNS, MNG_LC_END);
|
|
2706 |
#endif
|
|
2707 |
|
|
2708 |
return MNG_NOERROR;
|
|
2709 |
}
|
|
2710 |
|
|
2711 |
/* ************************************************************************** */
|
|
2712 |
|
|
2713 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
2714 |
mng_retcode mng_free_ani_trns (mng_datap pData,
|
|
2715 |
mng_objectp pObject)
|
|
2716 |
{
|
|
2717 |
#ifdef MNG_SUPPORT_TRACE
|
|
2718 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_TRNS, MNG_LC_START);
|
|
2719 |
#endif
|
|
2720 |
|
|
2721 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_trns));
|
|
2722 |
|
|
2723 |
#ifdef MNG_SUPPORT_TRACE
|
|
2724 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_TRNS, MNG_LC_END);
|
|
2725 |
#endif
|
|
2726 |
|
|
2727 |
return MNG_NOERROR;
|
|
2728 |
}
|
|
2729 |
#endif
|
|
2730 |
|
|
2731 |
/* ************************************************************************** */
|
|
2732 |
|
|
2733 |
mng_retcode mng_process_ani_trns (mng_datap pData,
|
|
2734 |
mng_objectp pObject)
|
|
2735 |
{
|
|
2736 |
mng_ani_trnsp pTRNS = (mng_ani_trnsp)pObject;
|
|
2737 |
|
|
2738 |
#ifdef MNG_SUPPORT_TRACE
|
|
2739 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TRNS, MNG_LC_START);
|
|
2740 |
#endif
|
|
2741 |
|
|
2742 |
pData->bHasglobalTRNS = MNG_TRUE;
|
|
2743 |
pData->iGlobalTRNSrawlen = pTRNS->iRawlen;
|
|
2744 |
|
|
2745 |
MNG_COPY (pData->aGlobalTRNSrawdata, pTRNS->aRawdata, sizeof (pTRNS->aRawdata));
|
|
2746 |
|
|
2747 |
#ifdef MNG_SUPPORT_TRACE
|
|
2748 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TRNS, MNG_LC_END);
|
|
2749 |
#endif
|
|
2750 |
|
|
2751 |
return MNG_NOERROR;
|
|
2752 |
}
|
|
2753 |
|
|
2754 |
/* ************************************************************************** */
|
|
2755 |
/* ************************************************************************** */
|
|
2756 |
|
|
2757 |
#ifndef MNG_SKIPCHUNK_gAMA
|
|
2758 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2759 |
mng_retcode mng_create_ani_gama (mng_datap pData,
|
|
2760 |
mng_bool bEmpty,
|
|
2761 |
mng_uint32 iGamma)
|
|
2762 |
#else
|
|
2763 |
mng_retcode mng_create_ani_gama (mng_datap pData,
|
|
2764 |
mng_chunkp pChunk)
|
|
2765 |
#endif
|
|
2766 |
{
|
|
2767 |
mng_ani_gamap pGAMA;
|
|
2768 |
|
|
2769 |
#ifdef MNG_SUPPORT_TRACE
|
|
2770 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_GAMA, MNG_LC_START);
|
|
2771 |
#endif
|
|
2772 |
|
|
2773 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
2774 |
{
|
|
2775 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
2776 |
mng_ptr pTemp;
|
|
2777 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_gama),
|
|
2778 |
mng_free_obj_general,
|
|
2779 |
mng_process_ani_gama,
|
|
2780 |
&pTemp);
|
|
2781 |
if (iRetcode)
|
|
2782 |
return iRetcode;
|
|
2783 |
pGAMA = (mng_ani_gamap)pTemp;
|
|
2784 |
#else
|
|
2785 |
MNG_ALLOC (pData, pGAMA, sizeof (mng_ani_gama));
|
|
2786 |
|
|
2787 |
pGAMA->sHeader.fCleanup = mng_free_ani_gama;
|
|
2788 |
pGAMA->sHeader.fProcess = mng_process_ani_gama;
|
|
2789 |
#endif
|
|
2790 |
|
|
2791 |
mng_add_ani_object (pData, (mng_object_headerp)pGAMA);
|
|
2792 |
|
|
2793 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2794 |
pGAMA->bEmpty = bEmpty;
|
|
2795 |
pGAMA->iGamma = iGamma;
|
|
2796 |
#else
|
|
2797 |
pGAMA->bEmpty = ((mng_gamap)pChunk)->bEmpty;
|
|
2798 |
pGAMA->iGamma = ((mng_gamap)pChunk)->iGamma;
|
|
2799 |
#endif
|
|
2800 |
}
|
|
2801 |
|
|
2802 |
#ifdef MNG_SUPPORT_TRACE
|
|
2803 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_GAMA, MNG_LC_END);
|
|
2804 |
#endif
|
|
2805 |
|
|
2806 |
return MNG_NOERROR;
|
|
2807 |
}
|
|
2808 |
|
|
2809 |
/* ************************************************************************** */
|
|
2810 |
|
|
2811 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
2812 |
mng_retcode mng_free_ani_gama (mng_datap pData,
|
|
2813 |
mng_objectp pObject)
|
|
2814 |
{
|
|
2815 |
#ifdef MNG_SUPPORT_TRACE
|
|
2816 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_GAMA, MNG_LC_START);
|
|
2817 |
#endif
|
|
2818 |
|
|
2819 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_gama));
|
|
2820 |
|
|
2821 |
#ifdef MNG_SUPPORT_TRACE
|
|
2822 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_GAMA, MNG_LC_END);
|
|
2823 |
#endif
|
|
2824 |
|
|
2825 |
return MNG_NOERROR;
|
|
2826 |
}
|
|
2827 |
#endif
|
|
2828 |
|
|
2829 |
/* ************************************************************************** */
|
|
2830 |
|
|
2831 |
mng_retcode mng_process_ani_gama (mng_datap pData,
|
|
2832 |
mng_objectp pObject)
|
|
2833 |
{
|
|
2834 |
mng_ani_gamap pGAMA = (mng_ani_gamap)pObject;
|
|
2835 |
|
|
2836 |
#ifdef MNG_SUPPORT_TRACE
|
|
2837 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_GAMA, MNG_LC_START);
|
|
2838 |
#endif
|
|
2839 |
|
|
2840 |
if (pGAMA->bEmpty) /* empty chunk ? */
|
|
2841 |
{ /* clear global gAMA */
|
|
2842 |
pData->bHasglobalGAMA = MNG_FALSE;
|
|
2843 |
pData->iGlobalGamma = 0;
|
|
2844 |
}
|
|
2845 |
else
|
|
2846 |
{ /* set global gAMA */
|
|
2847 |
pData->bHasglobalGAMA = MNG_TRUE;
|
|
2848 |
pData->iGlobalGamma = pGAMA->iGamma;
|
|
2849 |
}
|
|
2850 |
|
|
2851 |
#ifdef MNG_SUPPORT_TRACE
|
|
2852 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_GAMA, MNG_LC_END);
|
|
2853 |
#endif
|
|
2854 |
|
|
2855 |
return MNG_NOERROR;
|
|
2856 |
}
|
|
2857 |
#endif
|
|
2858 |
|
|
2859 |
/* ************************************************************************** */
|
|
2860 |
/* ************************************************************************** */
|
|
2861 |
|
|
2862 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
2863 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2864 |
mng_retcode mng_create_ani_chrm (mng_datap pData,
|
|
2865 |
mng_bool bEmpty,
|
|
2866 |
mng_uint32 iWhitepointx,
|
|
2867 |
mng_uint32 iWhitepointy,
|
|
2868 |
mng_uint32 iRedx,
|
|
2869 |
mng_uint32 iRedy,
|
|
2870 |
mng_uint32 iGreenx,
|
|
2871 |
mng_uint32 iGreeny,
|
|
2872 |
mng_uint32 iBluex,
|
|
2873 |
mng_uint32 iBluey)
|
|
2874 |
#else
|
|
2875 |
mng_retcode mng_create_ani_chrm (mng_datap pData,
|
|
2876 |
mng_chunkp pChunk)
|
|
2877 |
#endif
|
|
2878 |
{
|
|
2879 |
mng_ani_chrmp pCHRM;
|
|
2880 |
|
|
2881 |
#ifdef MNG_SUPPORT_TRACE
|
|
2882 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_CHRM, MNG_LC_START);
|
|
2883 |
#endif
|
|
2884 |
|
|
2885 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
2886 |
{
|
|
2887 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
2888 |
mng_ptr pTemp;
|
|
2889 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_chrm),
|
|
2890 |
mng_free_obj_general,
|
|
2891 |
mng_process_ani_chrm,
|
|
2892 |
&pTemp);
|
|
2893 |
if (iRetcode)
|
|
2894 |
return iRetcode;
|
|
2895 |
pCHRM = (mng_ani_chrmp)pTemp;
|
|
2896 |
#else
|
|
2897 |
MNG_ALLOC (pData, pCHRM, sizeof (mng_ani_chrm));
|
|
2898 |
|
|
2899 |
pCHRM->sHeader.fCleanup = mng_free_ani_chrm;
|
|
2900 |
pCHRM->sHeader.fProcess = mng_process_ani_chrm;
|
|
2901 |
#endif
|
|
2902 |
|
|
2903 |
mng_add_ani_object (pData, (mng_object_headerp)pCHRM);
|
|
2904 |
|
|
2905 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
2906 |
pCHRM->bEmpty = bEmpty;
|
|
2907 |
pCHRM->iWhitepointx = iWhitepointx;
|
|
2908 |
pCHRM->iWhitepointy = iWhitepointy;
|
|
2909 |
pCHRM->iRedx = iRedx;
|
|
2910 |
pCHRM->iRedy = iRedy;
|
|
2911 |
pCHRM->iGreenx = iGreenx;
|
|
2912 |
pCHRM->iGreeny = iGreeny;
|
|
2913 |
pCHRM->iBluex = iBluex;
|
|
2914 |
pCHRM->iBluey = iBluey;
|
|
2915 |
#else
|
|
2916 |
pCHRM->bEmpty = ((mng_chrmp)pChunk)->bEmpty;
|
|
2917 |
pCHRM->iWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx;
|
|
2918 |
pCHRM->iWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy;
|
|
2919 |
pCHRM->iRedx = ((mng_chrmp)pChunk)->iRedx;
|
|
2920 |
pCHRM->iRedy = ((mng_chrmp)pChunk)->iRedy;
|
|
2921 |
pCHRM->iGreenx = ((mng_chrmp)pChunk)->iGreenx;
|
|
2922 |
pCHRM->iGreeny = ((mng_chrmp)pChunk)->iGreeny;
|
|
2923 |
pCHRM->iBluex = ((mng_chrmp)pChunk)->iBluex;
|
|
2924 |
pCHRM->iBluey = ((mng_chrmp)pChunk)->iBluey;
|
|
2925 |
#endif
|
|
2926 |
}
|
|
2927 |
|
|
2928 |
#ifdef MNG_SUPPORT_TRACE
|
|
2929 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_CHRM, MNG_LC_END);
|
|
2930 |
#endif
|
|
2931 |
|
|
2932 |
return MNG_NOERROR;
|
|
2933 |
}
|
|
2934 |
|
|
2935 |
/* ************************************************************************** */
|
|
2936 |
|
|
2937 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
2938 |
mng_retcode mng_free_ani_chrm (mng_datap pData,
|
|
2939 |
mng_objectp pObject)
|
|
2940 |
{
|
|
2941 |
#ifdef MNG_SUPPORT_TRACE
|
|
2942 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_CHRM, MNG_LC_START);
|
|
2943 |
#endif
|
|
2944 |
|
|
2945 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_chrm));
|
|
2946 |
|
|
2947 |
#ifdef MNG_SUPPORT_TRACE
|
|
2948 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_CHRM, MNG_LC_END);
|
|
2949 |
#endif
|
|
2950 |
|
|
2951 |
return MNG_NOERROR;
|
|
2952 |
}
|
|
2953 |
#endif
|
|
2954 |
|
|
2955 |
/* ************************************************************************** */
|
|
2956 |
|
|
2957 |
mng_retcode mng_process_ani_chrm (mng_datap pData,
|
|
2958 |
mng_objectp pObject)
|
|
2959 |
{
|
|
2960 |
mng_ani_chrmp pCHRM = (mng_ani_chrmp)pObject;
|
|
2961 |
|
|
2962 |
#ifdef MNG_SUPPORT_TRACE
|
|
2963 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CHRM, MNG_LC_START);
|
|
2964 |
#endif
|
|
2965 |
|
|
2966 |
if (pCHRM->bEmpty) /* empty chunk ? */
|
|
2967 |
{ /* clear global cHRM */
|
|
2968 |
pData->bHasglobalCHRM = MNG_FALSE;
|
|
2969 |
pData->iGlobalWhitepointx = 0;
|
|
2970 |
pData->iGlobalWhitepointy = 0;
|
|
2971 |
pData->iGlobalPrimaryredx = 0;
|
|
2972 |
pData->iGlobalPrimaryredy = 0;
|
|
2973 |
pData->iGlobalPrimarygreenx = 0;
|
|
2974 |
pData->iGlobalPrimarygreeny = 0;
|
|
2975 |
pData->iGlobalPrimarybluex = 0;
|
|
2976 |
pData->iGlobalPrimarybluey = 0;
|
|
2977 |
}
|
|
2978 |
else
|
|
2979 |
{ /* set global cHRM */
|
|
2980 |
pData->bHasglobalCHRM = MNG_TRUE;
|
|
2981 |
pData->iGlobalWhitepointx = pCHRM->iWhitepointx;
|
|
2982 |
pData->iGlobalWhitepointy = pCHRM->iWhitepointy;
|
|
2983 |
pData->iGlobalPrimaryredx = pCHRM->iRedx;
|
|
2984 |
pData->iGlobalPrimaryredy = pCHRM->iRedy;
|
|
2985 |
pData->iGlobalPrimarygreenx = pCHRM->iGreenx;
|
|
2986 |
pData->iGlobalPrimarygreeny = pCHRM->iGreeny;
|
|
2987 |
pData->iGlobalPrimarybluex = pCHRM->iBluex;
|
|
2988 |
pData->iGlobalPrimarybluey = pCHRM->iBluey;
|
|
2989 |
}
|
|
2990 |
|
|
2991 |
#ifdef MNG_SUPPORT_TRACE
|
|
2992 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CHRM, MNG_LC_END);
|
|
2993 |
#endif
|
|
2994 |
|
|
2995 |
return MNG_NOERROR;
|
|
2996 |
}
|
|
2997 |
#endif
|
|
2998 |
|
|
2999 |
/* ************************************************************************** */
|
|
3000 |
/* ************************************************************************** */
|
|
3001 |
|
|
3002 |
#ifndef MNG_SKIPCHUNK_sRGB
|
|
3003 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3004 |
mng_retcode mng_create_ani_srgb (mng_datap pData,
|
|
3005 |
mng_bool bEmpty,
|
|
3006 |
mng_uint8 iRenderingintent)
|
|
3007 |
#else
|
|
3008 |
mng_retcode mng_create_ani_srgb (mng_datap pData,
|
|
3009 |
mng_chunkp pChunk)
|
|
3010 |
#endif
|
|
3011 |
{
|
|
3012 |
mng_ani_srgbp pSRGB;
|
|
3013 |
|
|
3014 |
#ifdef MNG_SUPPORT_TRACE
|
|
3015 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SRGB, MNG_LC_START);
|
|
3016 |
#endif
|
|
3017 |
|
|
3018 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3019 |
{
|
|
3020 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3021 |
mng_ptr pTemp;
|
|
3022 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_srgb),
|
|
3023 |
mng_free_obj_general,
|
|
3024 |
mng_process_ani_srgb,
|
|
3025 |
&pTemp);
|
|
3026 |
if (iRetcode)
|
|
3027 |
return iRetcode;
|
|
3028 |
pSRGB = (mng_ani_srgbp)pTemp;
|
|
3029 |
#else
|
|
3030 |
MNG_ALLOC (pData, pSRGB, sizeof (mng_ani_srgb));
|
|
3031 |
|
|
3032 |
pSRGB->sHeader.fCleanup = mng_free_ani_srgb;
|
|
3033 |
pSRGB->sHeader.fProcess = mng_process_ani_srgb;
|
|
3034 |
#endif
|
|
3035 |
|
|
3036 |
mng_add_ani_object (pData, (mng_object_headerp)pSRGB);
|
|
3037 |
|
|
3038 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3039 |
pSRGB->bEmpty = bEmpty;
|
|
3040 |
pSRGB->iRenderingintent = iRenderingintent;
|
|
3041 |
#else
|
|
3042 |
pSRGB->bEmpty = ((mng_srgbp)pChunk)->bEmpty;
|
|
3043 |
pSRGB->iRenderingintent = ((mng_srgbp)pChunk)->iRenderingintent;
|
|
3044 |
#endif
|
|
3045 |
}
|
|
3046 |
|
|
3047 |
#ifdef MNG_SUPPORT_TRACE
|
|
3048 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SRGB, MNG_LC_END);
|
|
3049 |
#endif
|
|
3050 |
|
|
3051 |
return MNG_NOERROR;
|
|
3052 |
}
|
|
3053 |
|
|
3054 |
/* ************************************************************************** */
|
|
3055 |
|
|
3056 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3057 |
mng_retcode mng_free_ani_srgb (mng_datap pData,
|
|
3058 |
mng_objectp pObject)
|
|
3059 |
{
|
|
3060 |
#ifdef MNG_SUPPORT_TRACE
|
|
3061 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SRGB, MNG_LC_START);
|
|
3062 |
#endif
|
|
3063 |
|
|
3064 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_srgb));
|
|
3065 |
|
|
3066 |
#ifdef MNG_SUPPORT_TRACE
|
|
3067 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SRGB, MNG_LC_END);
|
|
3068 |
#endif
|
|
3069 |
|
|
3070 |
return MNG_NOERROR;
|
|
3071 |
}
|
|
3072 |
#endif
|
|
3073 |
|
|
3074 |
/* ************************************************************************** */
|
|
3075 |
|
|
3076 |
mng_retcode mng_process_ani_srgb (mng_datap pData,
|
|
3077 |
mng_objectp pObject)
|
|
3078 |
{
|
|
3079 |
mng_ani_srgbp pSRGB = (mng_ani_srgbp)pObject;
|
|
3080 |
|
|
3081 |
#ifdef MNG_SUPPORT_TRACE
|
|
3082 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SRGB, MNG_LC_START);
|
|
3083 |
#endif
|
|
3084 |
|
|
3085 |
if (pSRGB->bEmpty) /* empty chunk ? */
|
|
3086 |
{ /* clear global sRGB */
|
|
3087 |
pData->bHasglobalSRGB = MNG_FALSE;
|
|
3088 |
pData->iGlobalRendintent = 0;
|
|
3089 |
}
|
|
3090 |
else
|
|
3091 |
{ /* set global sRGB */
|
|
3092 |
pData->bHasglobalSRGB = MNG_TRUE;
|
|
3093 |
pData->iGlobalRendintent = pSRGB->iRenderingintent;
|
|
3094 |
}
|
|
3095 |
|
|
3096 |
#ifdef MNG_SUPPORT_TRACE
|
|
3097 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SRGB, MNG_LC_END);
|
|
3098 |
#endif
|
|
3099 |
|
|
3100 |
return MNG_NOERROR;
|
|
3101 |
}
|
|
3102 |
#endif
|
|
3103 |
|
|
3104 |
/* ************************************************************************** */
|
|
3105 |
/* ************************************************************************** */
|
|
3106 |
|
|
3107 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
3108 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3109 |
mng_retcode mng_create_ani_iccp (mng_datap pData,
|
|
3110 |
mng_bool bEmpty,
|
|
3111 |
mng_uint32 iProfilesize,
|
|
3112 |
mng_ptr pProfile)
|
|
3113 |
#else
|
|
3114 |
mng_retcode mng_create_ani_iccp (mng_datap pData,
|
|
3115 |
mng_chunkp pChunk)
|
|
3116 |
#endif
|
|
3117 |
{
|
|
3118 |
mng_ani_iccpp pICCP;
|
|
3119 |
|
|
3120 |
#ifdef MNG_SUPPORT_TRACE
|
|
3121 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_ICCP, MNG_LC_START);
|
|
3122 |
#endif
|
|
3123 |
|
|
3124 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3125 |
{
|
|
3126 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3127 |
mng_ptr pTemp;
|
|
3128 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_iccp),
|
|
3129 |
mng_free_ani_iccp,
|
|
3130 |
mng_process_ani_iccp,
|
|
3131 |
&pTemp);
|
|
3132 |
if (iRetcode)
|
|
3133 |
return iRetcode;
|
|
3134 |
pICCP = (mng_ani_iccpp)pTemp;
|
|
3135 |
#else
|
|
3136 |
MNG_ALLOC (pData, pICCP, sizeof (mng_ani_iccp));
|
|
3137 |
|
|
3138 |
pICCP->sHeader.fCleanup = mng_free_ani_iccp;
|
|
3139 |
pICCP->sHeader.fProcess = mng_process_ani_iccp;
|
|
3140 |
#endif
|
|
3141 |
|
|
3142 |
mng_add_ani_object (pData, (mng_object_headerp)pICCP);
|
|
3143 |
|
|
3144 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3145 |
pICCP->bEmpty = bEmpty;
|
|
3146 |
pICCP->iProfilesize = iProfilesize;
|
|
3147 |
|
|
3148 |
if (iProfilesize)
|
|
3149 |
{
|
|
3150 |
MNG_ALLOC (pData, pICCP->pProfile, iProfilesize);
|
|
3151 |
MNG_COPY (pICCP->pProfile, pProfile, iProfilesize);
|
|
3152 |
}
|
|
3153 |
#else
|
|
3154 |
pICCP->bEmpty = ((mng_iccpp)pChunk)->bEmpty;
|
|
3155 |
pICCP->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize;
|
|
3156 |
|
|
3157 |
if (pICCP->iProfilesize)
|
|
3158 |
{
|
|
3159 |
MNG_ALLOC (pData, pICCP->pProfile, pICCP->iProfilesize);
|
|
3160 |
MNG_COPY (pICCP->pProfile, ((mng_iccpp)pChunk)->pProfile, pICCP->iProfilesize);
|
|
3161 |
}
|
|
3162 |
#endif
|
|
3163 |
}
|
|
3164 |
|
|
3165 |
#ifdef MNG_SUPPORT_TRACE
|
|
3166 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_ICCP, MNG_LC_END);
|
|
3167 |
#endif
|
|
3168 |
|
|
3169 |
return MNG_NOERROR;
|
|
3170 |
}
|
|
3171 |
|
|
3172 |
/* ************************************************************************** */
|
|
3173 |
|
|
3174 |
mng_retcode mng_free_ani_iccp (mng_datap pData,
|
|
3175 |
mng_objectp pObject)
|
|
3176 |
{
|
|
3177 |
mng_ani_iccpp pICCP = (mng_ani_iccpp)pObject;
|
|
3178 |
|
|
3179 |
#ifdef MNG_SUPPORT_TRACE
|
|
3180 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_ICCP, MNG_LC_START);
|
|
3181 |
#endif
|
|
3182 |
|
|
3183 |
if (pICCP->iProfilesize)
|
|
3184 |
MNG_FREEX (pData, pICCP->pProfile, pICCP->iProfilesize);
|
|
3185 |
|
|
3186 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3187 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_iccp));
|
|
3188 |
#endif
|
|
3189 |
|
|
3190 |
#ifdef MNG_SUPPORT_TRACE
|
|
3191 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_ICCP, MNG_LC_END);
|
|
3192 |
#endif
|
|
3193 |
|
|
3194 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3195 |
return MNG_NOERROR;
|
|
3196 |
#else
|
|
3197 |
return mng_free_obj_general(pData, pObject);
|
|
3198 |
#endif
|
|
3199 |
}
|
|
3200 |
|
|
3201 |
/* ************************************************************************** */
|
|
3202 |
|
|
3203 |
mng_retcode mng_process_ani_iccp (mng_datap pData,
|
|
3204 |
mng_objectp pObject)
|
|
3205 |
{
|
|
3206 |
mng_ani_iccpp pICCP = (mng_ani_iccpp)pObject;
|
|
3207 |
|
|
3208 |
#ifdef MNG_SUPPORT_TRACE
|
|
3209 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ICCP, MNG_LC_START);
|
|
3210 |
#endif
|
|
3211 |
|
|
3212 |
if (pICCP->bEmpty) /* empty chunk ? */
|
|
3213 |
{ /* clear global iCCP */
|
|
3214 |
pData->bHasglobalICCP = MNG_FALSE;
|
|
3215 |
|
|
3216 |
if (pData->iGlobalProfilesize)
|
|
3217 |
MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize);
|
|
3218 |
|
|
3219 |
pData->iGlobalProfilesize = 0;
|
|
3220 |
pData->pGlobalProfile = MNG_NULL;
|
|
3221 |
}
|
|
3222 |
else
|
|
3223 |
{ /* set global iCCP */
|
|
3224 |
pData->bHasglobalICCP = MNG_TRUE;
|
|
3225 |
pData->iGlobalProfilesize = pICCP->iProfilesize;
|
|
3226 |
|
|
3227 |
if (pICCP->iProfilesize)
|
|
3228 |
{
|
|
3229 |
MNG_ALLOC (pData, pData->pGlobalProfile, pICCP->iProfilesize);
|
|
3230 |
MNG_COPY (pData->pGlobalProfile, pICCP->pProfile, pICCP->iProfilesize);
|
|
3231 |
}
|
|
3232 |
}
|
|
3233 |
|
|
3234 |
#ifdef MNG_SUPPORT_TRACE
|
|
3235 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ICCP, MNG_LC_END);
|
|
3236 |
#endif
|
|
3237 |
|
|
3238 |
return MNG_NOERROR;
|
|
3239 |
}
|
|
3240 |
#endif
|
|
3241 |
|
|
3242 |
/* ************************************************************************** */
|
|
3243 |
/* ************************************************************************** */
|
|
3244 |
|
|
3245 |
#ifndef MNG_SKIPCHUNK_bKGD
|
|
3246 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3247 |
mng_retcode mng_create_ani_bkgd (mng_datap pData,
|
|
3248 |
mng_uint16 iRed,
|
|
3249 |
mng_uint16 iGreen,
|
|
3250 |
mng_uint16 iBlue)
|
|
3251 |
#else
|
|
3252 |
mng_retcode mng_create_ani_bkgd (mng_datap pData)
|
|
3253 |
#endif
|
|
3254 |
{
|
|
3255 |
mng_ani_bkgdp pBKGD;
|
|
3256 |
|
|
3257 |
#ifdef MNG_SUPPORT_TRACE
|
|
3258 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_BKGD, MNG_LC_START);
|
|
3259 |
#endif
|
|
3260 |
|
|
3261 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3262 |
{
|
|
3263 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3264 |
mng_ptr pTemp;
|
|
3265 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_bkgd),
|
|
3266 |
mng_free_obj_general,
|
|
3267 |
mng_process_ani_bkgd,
|
|
3268 |
&pTemp);
|
|
3269 |
if (iRetcode)
|
|
3270 |
return iRetcode;
|
|
3271 |
pBKGD = (mng_ani_bkgdp)pTemp;
|
|
3272 |
#else
|
|
3273 |
MNG_ALLOC (pData, pBKGD, sizeof (mng_ani_bkgd));
|
|
3274 |
|
|
3275 |
pBKGD->sHeader.fCleanup = mng_free_ani_bkgd;
|
|
3276 |
pBKGD->sHeader.fProcess = mng_process_ani_bkgd;
|
|
3277 |
#endif
|
|
3278 |
|
|
3279 |
mng_add_ani_object (pData, (mng_object_headerp)pBKGD);
|
|
3280 |
|
|
3281 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3282 |
pBKGD->iRed = iRed;
|
|
3283 |
pBKGD->iGreen = iGreen;
|
|
3284 |
pBKGD->iBlue = iBlue;
|
|
3285 |
#else
|
|
3286 |
pBKGD->iRed = pData->iGlobalBKGDred;
|
|
3287 |
pBKGD->iGreen = pData->iGlobalBKGDgreen;
|
|
3288 |
pBKGD->iBlue = pData->iGlobalBKGDblue;
|
|
3289 |
#endif
|
|
3290 |
}
|
|
3291 |
|
|
3292 |
#ifdef MNG_SUPPORT_TRACE
|
|
3293 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_BKGD, MNG_LC_END);
|
|
3294 |
#endif
|
|
3295 |
|
|
3296 |
return MNG_NOERROR;
|
|
3297 |
}
|
|
3298 |
|
|
3299 |
/* ************************************************************************** */
|
|
3300 |
|
|
3301 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3302 |
mng_retcode mng_free_ani_bkgd (mng_datap pData,
|
|
3303 |
mng_objectp pObject)
|
|
3304 |
{
|
|
3305 |
#ifdef MNG_SUPPORT_TRACE
|
|
3306 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_BKGD, MNG_LC_START);
|
|
3307 |
#endif
|
|
3308 |
|
|
3309 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_bkgd));
|
|
3310 |
|
|
3311 |
#ifdef MNG_SUPPORT_TRACE
|
|
3312 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_BKGD, MNG_LC_END);
|
|
3313 |
#endif
|
|
3314 |
|
|
3315 |
return MNG_NOERROR;
|
|
3316 |
}
|
|
3317 |
#endif
|
|
3318 |
|
|
3319 |
/* ************************************************************************** */
|
|
3320 |
|
|
3321 |
mng_retcode mng_process_ani_bkgd (mng_datap pData,
|
|
3322 |
mng_objectp pObject)
|
|
3323 |
{
|
|
3324 |
mng_ani_bkgdp pBKGD = (mng_ani_bkgdp)pObject;
|
|
3325 |
|
|
3326 |
#ifdef MNG_SUPPORT_TRACE
|
|
3327 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BKGD, MNG_LC_START);
|
|
3328 |
#endif
|
|
3329 |
|
|
3330 |
pData->bHasglobalBKGD = MNG_TRUE;
|
|
3331 |
pData->iGlobalBKGDred = pBKGD->iRed;
|
|
3332 |
pData->iGlobalBKGDgreen = pBKGD->iGreen;
|
|
3333 |
pData->iGlobalBKGDblue = pBKGD->iBlue;
|
|
3334 |
|
|
3335 |
#ifdef MNG_SUPPORT_TRACE
|
|
3336 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BKGD, MNG_LC_END);
|
|
3337 |
#endif
|
|
3338 |
|
|
3339 |
return MNG_NOERROR;
|
|
3340 |
}
|
|
3341 |
#endif
|
|
3342 |
|
|
3343 |
/* ************************************************************************** */
|
|
3344 |
/* ************************************************************************** */
|
|
3345 |
|
|
3346 |
#ifndef MNG_SKIPCHUNK_LOOP
|
|
3347 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3348 |
mng_retcode mng_create_ani_loop (mng_datap pData,
|
|
3349 |
mng_uint8 iLevel,
|
|
3350 |
mng_uint32 iRepeatcount,
|
|
3351 |
mng_uint8 iTermcond,
|
|
3352 |
mng_uint32 iItermin,
|
|
3353 |
mng_uint32 iItermax,
|
|
3354 |
mng_uint32 iCount,
|
|
3355 |
mng_uint32p pSignals)
|
|
3356 |
#else
|
|
3357 |
mng_retcode mng_create_ani_loop (mng_datap pData,
|
|
3358 |
mng_chunkp pChunk)
|
|
3359 |
#endif
|
|
3360 |
{
|
|
3361 |
mng_ani_loopp pLOOP;
|
|
3362 |
|
|
3363 |
#ifdef MNG_SUPPORT_TRACE
|
|
3364 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_LOOP, MNG_LC_START);
|
|
3365 |
#endif
|
|
3366 |
|
|
3367 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3368 |
{
|
|
3369 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3370 |
mng_ptr pTemp;
|
|
3371 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_loop),
|
|
3372 |
mng_free_ani_loop,
|
|
3373 |
mng_process_ani_loop,
|
|
3374 |
&pTemp);
|
|
3375 |
if (iRetcode)
|
|
3376 |
return iRetcode;
|
|
3377 |
pLOOP = (mng_ani_loopp)pTemp;
|
|
3378 |
#else
|
|
3379 |
MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop));
|
|
3380 |
|
|
3381 |
pLOOP->sHeader.fCleanup = mng_free_ani_loop;
|
|
3382 |
pLOOP->sHeader.fProcess = mng_process_ani_loop;
|
|
3383 |
#endif
|
|
3384 |
|
|
3385 |
mng_add_ani_object (pData, (mng_object_headerp)pLOOP);
|
|
3386 |
|
|
3387 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3388 |
pLOOP->iLevel = iLevel;
|
|
3389 |
pLOOP->iRepeatcount = iRepeatcount;
|
|
3390 |
pLOOP->iTermcond = iTermcond;
|
|
3391 |
pLOOP->iItermin = iItermin;
|
|
3392 |
pLOOP->iItermax = iItermax;
|
|
3393 |
pLOOP->iCount = iCount;
|
|
3394 |
|
|
3395 |
#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED
|
|
3396 |
if (iCount)
|
|
3397 |
{
|
|
3398 |
MNG_ALLOC (pData, pLOOP->pSignals, (iCount << 1));
|
|
3399 |
MNG_COPY (pLOOP->pSignals, pSignals, (iCount << 1));
|
|
3400 |
}
|
|
3401 |
#endif
|
|
3402 |
#else /* MNG_OPTIMIZE_CHUNKREADER */
|
|
3403 |
pLOOP->iLevel = ((mng_loopp)pChunk)->iLevel;
|
|
3404 |
pLOOP->iRepeatcount = ((mng_loopp)pChunk)->iRepeat;
|
|
3405 |
pLOOP->iTermcond = ((mng_loopp)pChunk)->iTermination;
|
|
3406 |
pLOOP->iItermin = ((mng_loopp)pChunk)->iItermin;
|
|
3407 |
pLOOP->iItermax = ((mng_loopp)pChunk)->iItermax;
|
|
3408 |
pLOOP->iCount = ((mng_loopp)pChunk)->iCount;
|
|
3409 |
|
|
3410 |
#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED
|
|
3411 |
if (pLOOP->iCount)
|
|
3412 |
{
|
|
3413 |
MNG_ALLOC (pData, pLOOP->pSignals, (pLOOP->iCount << 1));
|
|
3414 |
MNG_COPY (pLOOP->pSignals, ((mng_loopp)pChunk)->pSignals, (pLOOP->iCount << 1));
|
|
3415 |
}
|
|
3416 |
#endif
|
|
3417 |
#endif /* MNG_OPTIMIZE_CHUNKREADER */
|
|
3418 |
/* running counter starts with repeat_count */
|
|
3419 |
pLOOP->iRunningcount = pLOOP->iRepeatcount;
|
|
3420 |
}
|
|
3421 |
|
|
3422 |
#ifdef MNG_SUPPORT_TRACE
|
|
3423 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_LOOP, MNG_LC_END);
|
|
3424 |
#endif
|
|
3425 |
|
|
3426 |
return MNG_NOERROR;
|
|
3427 |
}
|
|
3428 |
|
|
3429 |
/* ************************************************************************** */
|
|
3430 |
|
|
3431 |
mng_retcode mng_free_ani_loop (mng_datap pData,
|
|
3432 |
mng_objectp pObject)
|
|
3433 |
{
|
|
3434 |
#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED
|
|
3435 |
mng_ani_loopp pLOOP = (mng_ani_loopp)pObject;
|
|
3436 |
#endif
|
|
3437 |
|
|
3438 |
#ifdef MNG_SUPPORT_TRACE
|
|
3439 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_LOOP, MNG_LC_START);
|
|
3440 |
#endif
|
|
3441 |
|
|
3442 |
#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED
|
|
3443 |
if (pLOOP->iCount) /* drop signal buffer ? */
|
|
3444 |
MNG_FREEX (pData, pLOOP->pSignals, (pLOOP->iCount << 1));
|
|
3445 |
#endif
|
|
3446 |
|
|
3447 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3448 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_loop));
|
|
3449 |
#endif
|
|
3450 |
|
|
3451 |
#ifdef MNG_SUPPORT_TRACE
|
|
3452 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_LOOP, MNG_LC_END);
|
|
3453 |
#endif
|
|
3454 |
|
|
3455 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3456 |
return MNG_NOERROR;
|
|
3457 |
#else
|
|
3458 |
return mng_free_obj_general(pData, pObject);
|
|
3459 |
#endif
|
|
3460 |
}
|
|
3461 |
|
|
3462 |
/* ************************************************************************** */
|
|
3463 |
|
|
3464 |
mng_retcode mng_process_ani_loop (mng_datap pData,
|
|
3465 |
mng_objectp pObject)
|
|
3466 |
{
|
|
3467 |
mng_ani_loopp pLOOP = (mng_ani_loopp)pObject;
|
|
3468 |
|
|
3469 |
#ifdef MNG_SUPPORT_TRACE
|
|
3470 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_LOOP, MNG_LC_START);
|
|
3471 |
#endif
|
|
3472 |
/* just reset the running counter */
|
|
3473 |
pLOOP->iRunningcount = pLOOP->iRepeatcount;
|
|
3474 |
/* iteration=0 means we're skipping ! */
|
|
3475 |
if ((!pData->bSkipping) && (pLOOP->iRepeatcount == 0))
|
|
3476 |
pData->bSkipping = MNG_TRUE;
|
|
3477 |
|
|
3478 |
#ifdef MNG_SUPPORT_TRACE
|
|
3479 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_LOOP, MNG_LC_END);
|
|
3480 |
#endif
|
|
3481 |
|
|
3482 |
return MNG_NOERROR;
|
|
3483 |
}
|
|
3484 |
|
|
3485 |
/* ************************************************************************** */
|
|
3486 |
/* ************************************************************************** */
|
|
3487 |
|
|
3488 |
mng_retcode mng_create_ani_endl (mng_datap pData,
|
|
3489 |
mng_uint8 iLevel)
|
|
3490 |
{
|
|
3491 |
mng_ani_endlp pENDL;
|
|
3492 |
|
|
3493 |
#ifdef MNG_SUPPORT_TRACE
|
|
3494 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_ENDL, MNG_LC_START);
|
|
3495 |
#endif
|
|
3496 |
|
|
3497 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3498 |
{
|
|
3499 |
mng_retcode iRetcode;
|
|
3500 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3501 |
mng_ptr pTemp;
|
|
3502 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_endl),
|
|
3503 |
mng_free_obj_general,
|
|
3504 |
mng_process_ani_endl,
|
|
3505 |
&pTemp);
|
|
3506 |
if (iRetcode)
|
|
3507 |
return iRetcode;
|
|
3508 |
pENDL = (mng_ani_endlp)pTemp;
|
|
3509 |
#else
|
|
3510 |
MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl));
|
|
3511 |
|
|
3512 |
pENDL->sHeader.fCleanup = mng_free_ani_endl;
|
|
3513 |
pENDL->sHeader.fProcess = mng_process_ani_endl;
|
|
3514 |
#endif
|
|
3515 |
|
|
3516 |
mng_add_ani_object (pData, (mng_object_headerp)pENDL);
|
|
3517 |
|
|
3518 |
pENDL->iLevel = iLevel;
|
|
3519 |
|
|
3520 |
iRetcode = mng_process_ani_endl (pData, (mng_objectp)pENDL);
|
|
3521 |
if (iRetcode)
|
|
3522 |
return iRetcode;
|
|
3523 |
}
|
|
3524 |
|
|
3525 |
#ifdef MNG_SUPPORT_TRACE
|
|
3526 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_ENDL, MNG_LC_END);
|
|
3527 |
#endif
|
|
3528 |
|
|
3529 |
return MNG_NOERROR;
|
|
3530 |
}
|
|
3531 |
|
|
3532 |
/* ************************************************************************** */
|
|
3533 |
|
|
3534 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3535 |
mng_retcode mng_free_ani_endl (mng_datap pData,
|
|
3536 |
mng_objectp pObject)
|
|
3537 |
{
|
|
3538 |
#ifdef MNG_SUPPORT_TRACE
|
|
3539 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_ENDL, MNG_LC_START);
|
|
3540 |
#endif
|
|
3541 |
|
|
3542 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_endl));
|
|
3543 |
|
|
3544 |
#ifdef MNG_SUPPORT_TRACE
|
|
3545 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_ENDL, MNG_LC_END);
|
|
3546 |
#endif
|
|
3547 |
|
|
3548 |
return MNG_NOERROR;
|
|
3549 |
}
|
|
3550 |
#endif
|
|
3551 |
|
|
3552 |
/* ************************************************************************** */
|
|
3553 |
|
|
3554 |
mng_retcode mng_process_ani_endl (mng_datap pData,
|
|
3555 |
mng_objectp pObject)
|
|
3556 |
{
|
|
3557 |
mng_ani_endlp pENDL = (mng_ani_endlp)pObject;
|
|
3558 |
mng_ani_loopp pLOOP;
|
|
3559 |
|
|
3560 |
#ifdef MNG_SUPPORT_TRACE
|
|
3561 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_START);
|
|
3562 |
#endif
|
|
3563 |
|
|
3564 |
if (((pData->bDisplaying) && ((pData->bRunning) || (pData->bSearching))) ||
|
|
3565 |
(pData->bReading) )
|
|
3566 |
{
|
|
3567 |
pLOOP = pENDL->pLOOP; /* determine matching LOOP */
|
|
3568 |
|
|
3569 |
if (!pLOOP) /* haven't got it yet ? */
|
|
3570 |
{ /* go and look back in the list */
|
|
3571 |
pLOOP = (mng_ani_loopp)pENDL->sHeader.pPrev;
|
|
3572 |
|
|
3573 |
while ((pLOOP) &&
|
|
3574 |
((pLOOP->sHeader.fCleanup != mng_free_ani_loop) ||
|
|
3575 |
(pLOOP->iLevel != pENDL->iLevel) ))
|
|
3576 |
pLOOP = pLOOP->sHeader.pPrev;
|
|
3577 |
}
|
|
3578 |
/* got it now ? */
|
|
3579 |
if ((pLOOP) && (pLOOP->iLevel == pENDL->iLevel))
|
|
3580 |
{
|
|
3581 |
pENDL->pLOOP = pLOOP; /* save for next time ! */
|
|
3582 |
/* decrease running counter ? */
|
|
3583 |
if ((pLOOP->iRunningcount) && (pLOOP->iRunningcount < 0x7fffffffL))
|
|
3584 |
pLOOP->iRunningcount--;
|
|
3585 |
|
|
3586 |
if ((!pData->bDisplaying) && (pData->bReading) &&
|
|
3587 |
(pLOOP->iRunningcount >= 0x7fffffffL))
|
|
3588 |
{
|
|
3589 |
pData->iTotalframes = 0x7fffffffL;
|
|
3590 |
pData->iTotallayers = 0x7fffffffL;
|
|
3591 |
pData->iTotalplaytime = 0x7fffffffL;
|
|
3592 |
}
|
|
3593 |
else
|
|
3594 |
{
|
|
3595 |
/* TODO: we're cheating out on the termination_condition,
|
|
3596 |
iteration_min, iteration_max and possible signals;
|
|
3597 |
the code is just not ready for that can of worms.... */
|
|
3598 |
|
|
3599 |
if (!pLOOP->iRunningcount) /* reached zero ? */
|
|
3600 |
{ /* was this the outer LOOP ? */
|
|
3601 |
if (pData->pFirstaniobj == (mng_objectp)pLOOP) /* TODO: THIS IS WRONG!! */
|
|
3602 |
pData->bHasLOOP = MNG_FALSE;
|
|
3603 |
}
|
|
3604 |
else
|
|
3605 |
{
|
|
3606 |
if (pData->pCurraniobj) /* was we processing objects ? */
|
|
3607 |
pData->pCurraniobj = pLOOP;/* then restart with LOOP */
|
|
3608 |
else /* else restart behind LOOP !!! */
|
|
3609 |
pData->pCurraniobj = pLOOP->sHeader.pNext;
|
|
3610 |
}
|
|
3611 |
}
|
|
3612 |
/* does this match a 'skipping' LOOP? */
|
|
3613 |
if ((pData->bSkipping) && (pLOOP->iRepeatcount == 0))
|
|
3614 |
pData->bSkipping = MNG_FALSE;
|
|
3615 |
}
|
|
3616 |
else
|
|
3617 |
MNG_ERROR (pData, MNG_NOMATCHINGLOOP);
|
|
3618 |
|
|
3619 |
}
|
|
3620 |
|
|
3621 |
#ifdef MNG_SUPPORT_TRACE
|
|
3622 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_END);
|
|
3623 |
#endif
|
|
3624 |
|
|
3625 |
return MNG_NOERROR;
|
|
3626 |
}
|
|
3627 |
#endif
|
|
3628 |
|
|
3629 |
/* ************************************************************************** */
|
|
3630 |
|
|
3631 |
#ifndef MNG_SKIPCHUNK_DEFI
|
|
3632 |
mng_retcode mng_create_ani_defi (mng_datap pData)
|
|
3633 |
{
|
|
3634 |
mng_ani_defip pDEFI;
|
|
3635 |
|
|
3636 |
#ifdef MNG_SUPPORT_TRACE
|
|
3637 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_DEFI, MNG_LC_START);
|
|
3638 |
#endif
|
|
3639 |
|
|
3640 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3641 |
{
|
|
3642 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3643 |
mng_ptr pTemp;
|
|
3644 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_defi),
|
|
3645 |
mng_free_obj_general,
|
|
3646 |
mng_process_ani_defi,
|
|
3647 |
&pTemp);
|
|
3648 |
if (iRetcode)
|
|
3649 |
return iRetcode;
|
|
3650 |
pDEFI = (mng_ani_defip)pTemp;
|
|
3651 |
#else
|
|
3652 |
MNG_ALLOC (pData, pDEFI, sizeof (mng_ani_defi));
|
|
3653 |
|
|
3654 |
pDEFI->sHeader.fCleanup = mng_free_ani_defi;
|
|
3655 |
pDEFI->sHeader.fProcess = mng_process_ani_defi;
|
|
3656 |
#endif
|
|
3657 |
|
|
3658 |
mng_add_ani_object (pData, (mng_object_headerp)pDEFI);
|
|
3659 |
|
|
3660 |
pDEFI->iId = pData->iDEFIobjectid;
|
|
3661 |
pDEFI->bHasdonotshow = pData->bDEFIhasdonotshow;
|
|
3662 |
pDEFI->iDonotshow = pData->iDEFIdonotshow;
|
|
3663 |
pDEFI->bHasconcrete = pData->bDEFIhasconcrete;
|
|
3664 |
pDEFI->iConcrete = pData->iDEFIconcrete;
|
|
3665 |
pDEFI->bHasloca = pData->bDEFIhasloca;
|
|
3666 |
pDEFI->iLocax = pData->iDEFIlocax;
|
|
3667 |
pDEFI->iLocay = pData->iDEFIlocay;
|
|
3668 |
pDEFI->bHasclip = pData->bDEFIhasclip;
|
|
3669 |
pDEFI->iClipl = pData->iDEFIclipl;
|
|
3670 |
pDEFI->iClipr = pData->iDEFIclipr;
|
|
3671 |
pDEFI->iClipt = pData->iDEFIclipt;
|
|
3672 |
pDEFI->iClipb = pData->iDEFIclipb;
|
|
3673 |
}
|
|
3674 |
|
|
3675 |
#ifdef MNG_SUPPORT_TRACE
|
|
3676 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_DEFI, MNG_LC_END);
|
|
3677 |
#endif
|
|
3678 |
|
|
3679 |
return MNG_NOERROR;
|
|
3680 |
}
|
|
3681 |
|
|
3682 |
/* ************************************************************************** */
|
|
3683 |
|
|
3684 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3685 |
mng_retcode mng_free_ani_defi (mng_datap pData,
|
|
3686 |
mng_objectp pObject)
|
|
3687 |
{
|
|
3688 |
#ifdef MNG_SUPPORT_TRACE
|
|
3689 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_DEFI, MNG_LC_START);
|
|
3690 |
#endif
|
|
3691 |
|
|
3692 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_defi));
|
|
3693 |
|
|
3694 |
#ifdef MNG_SUPPORT_TRACE
|
|
3695 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_DEFI, MNG_LC_END);
|
|
3696 |
#endif
|
|
3697 |
|
|
3698 |
return MNG_NOERROR;
|
|
3699 |
}
|
|
3700 |
#endif
|
|
3701 |
|
|
3702 |
/* ************************************************************************** */
|
|
3703 |
|
|
3704 |
mng_retcode mng_process_ani_defi (mng_datap pData,
|
|
3705 |
mng_objectp pObject)
|
|
3706 |
{
|
|
3707 |
mng_ani_defip pDEFI = (mng_ani_defip)pObject;
|
|
3708 |
mng_retcode iRetcode;
|
|
3709 |
|
|
3710 |
#ifdef MNG_SUPPORT_TRACE
|
|
3711 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DEFI, MNG_LC_START);
|
|
3712 |
#endif
|
|
3713 |
|
|
3714 |
pData->iDEFIobjectid = pDEFI->iId;
|
|
3715 |
pData->bDEFIhasdonotshow = pDEFI->bHasdonotshow;
|
|
3716 |
pData->iDEFIdonotshow = pDEFI->iDonotshow;
|
|
3717 |
pData->bDEFIhasconcrete = pDEFI->bHasconcrete;
|
|
3718 |
pData->iDEFIconcrete = pDEFI->iConcrete;
|
|
3719 |
pData->bDEFIhasloca = pDEFI->bHasloca;
|
|
3720 |
pData->iDEFIlocax = pDEFI->iLocax;
|
|
3721 |
pData->iDEFIlocay = pDEFI->iLocay;
|
|
3722 |
pData->bDEFIhasclip = pDEFI->bHasclip;
|
|
3723 |
pData->iDEFIclipl = pDEFI->iClipl;
|
|
3724 |
pData->iDEFIclipr = pDEFI->iClipr;
|
|
3725 |
pData->iDEFIclipt = pDEFI->iClipt;
|
|
3726 |
pData->iDEFIclipb = pDEFI->iClipb;
|
|
3727 |
|
|
3728 |
iRetcode = mng_process_display_defi (pData);
|
|
3729 |
|
|
3730 |
if (iRetcode) /* on error bail out */
|
|
3731 |
return iRetcode;
|
|
3732 |
|
|
3733 |
#ifdef MNG_SUPPORT_TRACE
|
|
3734 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DEFI, MNG_LC_END);
|
|
3735 |
#endif
|
|
3736 |
|
|
3737 |
return MNG_NOERROR;
|
|
3738 |
}
|
|
3739 |
#endif
|
|
3740 |
|
|
3741 |
/* ************************************************************************** */
|
|
3742 |
/* ************************************************************************** */
|
|
3743 |
|
|
3744 |
#ifndef MNG_SKIPCHUNK_BASI
|
|
3745 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3746 |
mng_retcode mng_create_ani_basi (mng_datap pData,
|
|
3747 |
mng_uint16 iRed,
|
|
3748 |
mng_uint16 iGreen,
|
|
3749 |
mng_uint16 iBlue,
|
|
3750 |
mng_bool bHasalpha,
|
|
3751 |
mng_uint16 iAlpha,
|
|
3752 |
mng_uint8 iViewable)
|
|
3753 |
#else
|
|
3754 |
mng_retcode mng_create_ani_basi (mng_datap pData,
|
|
3755 |
mng_chunkp pChunk)
|
|
3756 |
#endif
|
|
3757 |
{
|
|
3758 |
mng_ani_basip pBASI;
|
|
3759 |
mng_retcode iRetcode;
|
|
3760 |
|
|
3761 |
#ifdef MNG_SUPPORT_TRACE
|
|
3762 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_BASI, MNG_LC_START);
|
|
3763 |
#endif
|
|
3764 |
|
|
3765 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3766 |
{
|
|
3767 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3768 |
mng_ptr pTemp;
|
|
3769 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_basi),
|
|
3770 |
mng_free_obj_general,
|
|
3771 |
mng_process_ani_basi,
|
|
3772 |
&pTemp);
|
|
3773 |
if (iRetcode)
|
|
3774 |
return iRetcode;
|
|
3775 |
pBASI = (mng_ani_basip)pTemp;
|
|
3776 |
#else
|
|
3777 |
MNG_ALLOC (pData, pBASI, sizeof (mng_ani_basi));
|
|
3778 |
|
|
3779 |
pBASI->sHeader.fCleanup = mng_free_ani_basi;
|
|
3780 |
pBASI->sHeader.fProcess = mng_process_ani_basi;
|
|
3781 |
#endif
|
|
3782 |
|
|
3783 |
mng_add_ani_object (pData, (mng_object_headerp)pBASI);
|
|
3784 |
|
|
3785 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3786 |
pBASI->iRed = iRed;
|
|
3787 |
pBASI->iGreen = iGreen;
|
|
3788 |
pBASI->iBlue = iBlue;
|
|
3789 |
pBASI->bHasalpha = bHasalpha;
|
|
3790 |
pBASI->iAlpha = iAlpha;
|
|
3791 |
pBASI->iViewable = iViewable;
|
|
3792 |
#else
|
|
3793 |
pBASI->iRed = ((mng_basip)pChunk)->iRed;
|
|
3794 |
pBASI->iGreen = ((mng_basip)pChunk)->iGreen;
|
|
3795 |
pBASI->iBlue = ((mng_basip)pChunk)->iBlue;
|
|
3796 |
pBASI->bHasalpha = ((mng_basip)pChunk)->bHasalpha;
|
|
3797 |
pBASI->iAlpha = ((mng_basip)pChunk)->iAlpha;
|
|
3798 |
pBASI->iViewable = ((mng_basip)pChunk)->iViewable;
|
|
3799 |
#endif
|
|
3800 |
}
|
|
3801 |
|
|
3802 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
3803 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3804 |
iRetcode = mng_process_display_basi (pData, iRed, iGreen, iBlue,
|
|
3805 |
bHasalpha, iAlpha, iViewable);
|
|
3806 |
#else
|
|
3807 |
iRetcode = mng_process_display_basi (pData,
|
|
3808 |
((mng_basip)pChunk)->iRed,
|
|
3809 |
((mng_basip)pChunk)->iGreen,
|
|
3810 |
((mng_basip)pChunk)->iBlue,
|
|
3811 |
((mng_basip)pChunk)->bHasalpha,
|
|
3812 |
((mng_basip)pChunk)->iAlpha,
|
|
3813 |
((mng_basip)pChunk)->iViewable);
|
|
3814 |
#endif
|
|
3815 |
#else
|
|
3816 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3817 |
pData->iBASIred = iRed;
|
|
3818 |
pData->iBASIgreen = iGreen;
|
|
3819 |
pData->iBASIblue = iBlue;
|
|
3820 |
pData->bBASIhasalpha = bHasalpha;
|
|
3821 |
pData->iBASIalpha = iAlpha;
|
|
3822 |
pData->iBASIviewable = iViewable;
|
|
3823 |
#else
|
|
3824 |
pData->iBASIred = ((mng_basip)pChunk)->iRed;
|
|
3825 |
pData->iBASIgreen = ((mng_basip)pChunk)->iGreen;
|
|
3826 |
pData->iBASIblue = ((mng_basip)pChunk)->iBlue;
|
|
3827 |
pData->bBASIhasalpha = ((mng_basip)pChunk)->bHasalpha;
|
|
3828 |
pData->iBASIalpha = ((mng_basip)pChunk)->iAlpha;
|
|
3829 |
pData->iBASIviewable = ((mng_basip)pChunk)->iViewable;
|
|
3830 |
#endif
|
|
3831 |
|
|
3832 |
iRetcode = mng_process_display_basi (pData);
|
|
3833 |
#endif
|
|
3834 |
|
|
3835 |
#ifdef MNG_SUPPORT_TRACE
|
|
3836 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_BASI, MNG_LC_END);
|
|
3837 |
#endif
|
|
3838 |
|
|
3839 |
return iRetcode;
|
|
3840 |
}
|
|
3841 |
|
|
3842 |
/* ************************************************************************** */
|
|
3843 |
|
|
3844 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
3845 |
mng_retcode mng_free_ani_basi (mng_datap pData,
|
|
3846 |
mng_objectp pObject)
|
|
3847 |
{
|
|
3848 |
#ifdef MNG_SUPPORT_TRACE
|
|
3849 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_BASI, MNG_LC_START);
|
|
3850 |
#endif
|
|
3851 |
|
|
3852 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_basi));
|
|
3853 |
|
|
3854 |
#ifdef MNG_SUPPORT_TRACE
|
|
3855 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_BASI, MNG_LC_END);
|
|
3856 |
#endif
|
|
3857 |
|
|
3858 |
return MNG_NOERROR;
|
|
3859 |
}
|
|
3860 |
#endif
|
|
3861 |
|
|
3862 |
/* ************************************************************************** */
|
|
3863 |
|
|
3864 |
mng_retcode mng_process_ani_basi (mng_datap pData,
|
|
3865 |
mng_objectp pObject)
|
|
3866 |
{
|
|
3867 |
mng_ani_basip pBASI = (mng_ani_basip)pObject;
|
|
3868 |
mng_retcode iRetcode;
|
|
3869 |
|
|
3870 |
#ifdef MNG_SUPPORT_TRACE
|
|
3871 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BASI, MNG_LC_START);
|
|
3872 |
#endif
|
|
3873 |
|
|
3874 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
3875 |
iRetcode = mng_process_display_basi (pData, pBASI->iRed, pBASI->iGreen, pBASI->iBlue,
|
|
3876 |
pBASI->bHasalpha, pBASI->iAlpha, pBASI->iViewable);
|
|
3877 |
#else
|
|
3878 |
pData->iBASIred = pBASI->iRed;
|
|
3879 |
pData->iBASIgreen = pBASI->iGreen;
|
|
3880 |
pData->iBASIblue = pBASI->iBlue;
|
|
3881 |
pData->bBASIhasalpha = pBASI->bHasalpha;
|
|
3882 |
pData->iBASIalpha = pBASI->iAlpha;
|
|
3883 |
pData->iBASIviewable = pBASI->iViewable;
|
|
3884 |
|
|
3885 |
iRetcode = mng_process_display_basi (pData);
|
|
3886 |
#endif
|
|
3887 |
|
|
3888 |
#ifdef MNG_SUPPORT_TRACE
|
|
3889 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BASI, MNG_LC_END);
|
|
3890 |
#endif
|
|
3891 |
|
|
3892 |
return iRetcode;
|
|
3893 |
}
|
|
3894 |
#endif
|
|
3895 |
|
|
3896 |
/* ************************************************************************** */
|
|
3897 |
|
|
3898 |
#ifndef MNG_SKIPCHUNK_CLON
|
|
3899 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3900 |
mng_retcode mng_create_ani_clon (mng_datap pData,
|
|
3901 |
mng_uint16 iSourceid,
|
|
3902 |
mng_uint16 iCloneid,
|
|
3903 |
mng_uint8 iClonetype,
|
|
3904 |
mng_bool bHasdonotshow,
|
|
3905 |
mng_uint8 iDonotshow,
|
|
3906 |
mng_uint8 iConcrete,
|
|
3907 |
mng_bool bHasloca,
|
|
3908 |
mng_uint8 iLocatype,
|
|
3909 |
mng_int32 iLocax,
|
|
3910 |
mng_int32 iLocay)
|
|
3911 |
#else
|
|
3912 |
mng_retcode mng_create_ani_clon (mng_datap pData,
|
|
3913 |
mng_chunkp pChunk)
|
|
3914 |
#endif
|
|
3915 |
{
|
|
3916 |
mng_ani_clonp pCLON;
|
|
3917 |
mng_retcode iRetcode;
|
|
3918 |
|
|
3919 |
#ifdef MNG_SUPPORT_TRACE
|
|
3920 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLON, MNG_LC_START);
|
|
3921 |
#endif
|
|
3922 |
|
|
3923 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
3924 |
{
|
|
3925 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
3926 |
mng_ptr pTemp;
|
|
3927 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_clon),
|
|
3928 |
mng_free_obj_general,
|
|
3929 |
mng_process_ani_clon,
|
|
3930 |
&pTemp);
|
|
3931 |
if (iRetcode)
|
|
3932 |
return iRetcode;
|
|
3933 |
pCLON = (mng_ani_clonp)pTemp;
|
|
3934 |
#else
|
|
3935 |
MNG_ALLOC (pData, pCLON, sizeof (mng_ani_clon));
|
|
3936 |
|
|
3937 |
pCLON->sHeader.fCleanup = mng_free_ani_clon;
|
|
3938 |
pCLON->sHeader.fProcess = mng_process_ani_clon;
|
|
3939 |
#endif
|
|
3940 |
|
|
3941 |
mng_add_ani_object (pData, (mng_object_headerp)pCLON);
|
|
3942 |
|
|
3943 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3944 |
pCLON->iSourceid = iSourceid;
|
|
3945 |
pCLON->iCloneid = iCloneid;
|
|
3946 |
pCLON->iClonetype = iClonetype;
|
|
3947 |
pCLON->bHasdonotshow = bHasdonotshow;
|
|
3948 |
pCLON->iDonotshow = iDonotshow;
|
|
3949 |
pCLON->iConcrete = iConcrete;
|
|
3950 |
pCLON->bHasloca = bHasloca;
|
|
3951 |
pCLON->iLocatype = iLocatype;
|
|
3952 |
pCLON->iLocax = iLocax;
|
|
3953 |
pCLON->iLocay = iLocay;
|
|
3954 |
#else
|
|
3955 |
pCLON->iSourceid = ((mng_clonp)pChunk)->iSourceid;
|
|
3956 |
pCLON->iCloneid = ((mng_clonp)pChunk)->iCloneid;
|
|
3957 |
pCLON->iClonetype = ((mng_clonp)pChunk)->iClonetype;
|
|
3958 |
pCLON->bHasdonotshow = ((mng_clonp)pChunk)->bHasdonotshow;
|
|
3959 |
pCLON->iDonotshow = ((mng_clonp)pChunk)->iDonotshow;
|
|
3960 |
pCLON->iConcrete = ((mng_clonp)pChunk)->iConcrete;
|
|
3961 |
pCLON->bHasloca = ((mng_clonp)pChunk)->bHasloca;
|
|
3962 |
pCLON->iLocatype = ((mng_clonp)pChunk)->iLocationtype;
|
|
3963 |
pCLON->iLocax = ((mng_clonp)pChunk)->iLocationx;
|
|
3964 |
pCLON->iLocay = ((mng_clonp)pChunk)->iLocationy;
|
|
3965 |
#endif
|
|
3966 |
}
|
|
3967 |
|
|
3968 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
3969 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3970 |
iRetcode = mng_process_display_clon (pData, iSourceid, iCloneid, iClonetype,
|
|
3971 |
bHasdonotshow, iDonotshow, iConcrete,
|
|
3972 |
bHasloca, iLocatype, iLocax, iLocay);
|
|
3973 |
#else
|
|
3974 |
iRetcode = mng_process_display_clon (pData,
|
|
3975 |
((mng_clonp)pChunk)->iSourceid,
|
|
3976 |
((mng_clonp)pChunk)->iCloneid,
|
|
3977 |
((mng_clonp)pChunk)->iClonetype,
|
|
3978 |
((mng_clonp)pChunk)->bHasdonotshow,
|
|
3979 |
((mng_clonp)pChunk)->iDonotshow,
|
|
3980 |
((mng_clonp)pChunk)->iConcrete,
|
|
3981 |
((mng_clonp)pChunk)->bHasloca,
|
|
3982 |
((mng_clonp)pChunk)->iLocationtype,
|
|
3983 |
((mng_clonp)pChunk)->iLocationx,
|
|
3984 |
((mng_clonp)pChunk)->iLocationy);
|
|
3985 |
#endif
|
|
3986 |
#else
|
|
3987 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
3988 |
pData->iCLONsourceid = iSourceid;
|
|
3989 |
pData->iCLONcloneid = iCloneid;
|
|
3990 |
pData->iCLONclonetype = iClonetype;
|
|
3991 |
pData->bCLONhasdonotshow = bHasdonotshow;
|
|
3992 |
pData->iCLONdonotshow = iDonotshow;
|
|
3993 |
pData->iCLONconcrete = iConcrete;
|
|
3994 |
pData->bCLONhasloca = bHasloca;
|
|
3995 |
pData->iCLONlocationtype = iLocatype;
|
|
3996 |
pData->iCLONlocationx = iLocax;
|
|
3997 |
pData->iCLONlocationy = iLocay;
|
|
3998 |
#else
|
|
3999 |
pData->iCLONsourceid = ((mng_clonp)pChunk)->iSourceid;
|
|
4000 |
pData->iCLONcloneid = ((mng_clonp)pChunk)->iCloneid;
|
|
4001 |
pData->iCLONclonetype = ((mng_clonp)pChunk)->iClonetype;
|
|
4002 |
pData->bCLONhasdonotshow = ((mng_clonp)pChunk)->bHasdonotshow;
|
|
4003 |
pData->iCLONdonotshow = ((mng_clonp)pChunk)->iDonotshow;
|
|
4004 |
pData->iCLONconcrete = ((mng_clonp)pChunk)->iConcrete;
|
|
4005 |
pData->bCLONhasloca = ((mng_clonp)pChunk)->bHasloca;
|
|
4006 |
pData->iCLONlocationtype = ((mng_clonp)pChunk)->iLocationtype;
|
|
4007 |
pData->iCLONlocationx = ((mng_clonp)pChunk)->iLocationx;
|
|
4008 |
pData->iCLONlocationy = ((mng_clonp)pChunk)->iLocationy;
|
|
4009 |
#endif
|
|
4010 |
|
|
4011 |
iRetcode = mng_process_display_clon (pData);
|
|
4012 |
#endif
|
|
4013 |
|
|
4014 |
#ifdef MNG_SUPPORT_TRACE
|
|
4015 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLON, MNG_LC_END);
|
|
4016 |
#endif
|
|
4017 |
|
|
4018 |
return iRetcode;
|
|
4019 |
}
|
|
4020 |
|
|
4021 |
/* ************************************************************************** */
|
|
4022 |
|
|
4023 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4024 |
mng_retcode mng_free_ani_clon (mng_datap pData,
|
|
4025 |
mng_objectp pObject)
|
|
4026 |
{
|
|
4027 |
#ifdef MNG_SUPPORT_TRACE
|
|
4028 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_CLON, MNG_LC_START);
|
|
4029 |
#endif
|
|
4030 |
|
|
4031 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_clon));
|
|
4032 |
|
|
4033 |
#ifdef MNG_SUPPORT_TRACE
|
|
4034 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_CLON, MNG_LC_END);
|
|
4035 |
#endif
|
|
4036 |
|
|
4037 |
return MNG_NOERROR;
|
|
4038 |
}
|
|
4039 |
#endif
|
|
4040 |
|
|
4041 |
/* ************************************************************************** */
|
|
4042 |
|
|
4043 |
mng_retcode mng_process_ani_clon (mng_datap pData,
|
|
4044 |
mng_objectp pObject)
|
|
4045 |
{
|
|
4046 |
mng_ani_clonp pCLON = (mng_ani_clonp)pObject;
|
|
4047 |
mng_retcode iRetcode;
|
|
4048 |
|
|
4049 |
#ifdef MNG_SUPPORT_TRACE
|
|
4050 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLON, MNG_LC_START);
|
|
4051 |
#endif
|
|
4052 |
|
|
4053 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4054 |
iRetcode = mng_process_display_clon (pData, pCLON->iSourceid, pCLON->iCloneid,
|
|
4055 |
pCLON->iClonetype, pCLON->bHasdonotshow,
|
|
4056 |
pCLON->iDonotshow, pCLON->iConcrete,
|
|
4057 |
pCLON->bHasloca, pCLON->iLocatype,
|
|
4058 |
pCLON->iLocax, pCLON->iLocay);
|
|
4059 |
#else
|
|
4060 |
pData->iCLONcloneid = pCLON->iCloneid;
|
|
4061 |
pData->iCLONsourceid = pCLON->iSourceid;
|
|
4062 |
pData->iCLONclonetype = pCLON->iClonetype;
|
|
4063 |
pData->bCLONhasdonotshow = pCLON->bHasdonotshow;
|
|
4064 |
pData->iCLONdonotshow = pCLON->iDonotshow;
|
|
4065 |
pData->iCLONconcrete = pCLON->iConcrete;
|
|
4066 |
pData->bCLONhasloca = pCLON->bHasloca;
|
|
4067 |
pData->iCLONlocationtype = pCLON->iLocatype;
|
|
4068 |
pData->iCLONlocationx = pCLON->iLocax;
|
|
4069 |
pData->iCLONlocationy = pCLON->iLocay;
|
|
4070 |
|
|
4071 |
iRetcode = mng_process_display_clon (pData);
|
|
4072 |
#endif
|
|
4073 |
|
|
4074 |
#ifdef MNG_SUPPORT_TRACE
|
|
4075 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLON, MNG_LC_END);
|
|
4076 |
#endif
|
|
4077 |
|
|
4078 |
return iRetcode;
|
|
4079 |
}
|
|
4080 |
#endif
|
|
4081 |
|
|
4082 |
/* ************************************************************************** */
|
|
4083 |
|
|
4084 |
#ifndef MNG_SKIPCHUNK_BACK
|
|
4085 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4086 |
mng_retcode mng_create_ani_back (mng_datap pData,
|
|
4087 |
mng_uint16 iRed,
|
|
4088 |
mng_uint16 iGreen,
|
|
4089 |
mng_uint16 iBlue,
|
|
4090 |
mng_uint8 iMandatory,
|
|
4091 |
mng_uint16 iImageid,
|
|
4092 |
mng_uint8 iTile)
|
|
4093 |
#else
|
|
4094 |
mng_retcode mng_create_ani_back (mng_datap pData)
|
|
4095 |
#endif
|
|
4096 |
{
|
|
4097 |
mng_ani_backp pBACK;
|
|
4098 |
|
|
4099 |
#ifdef MNG_SUPPORT_TRACE
|
|
4100 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_BACK, MNG_LC_START);
|
|
4101 |
#endif
|
|
4102 |
|
|
4103 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4104 |
{
|
|
4105 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4106 |
mng_ptr pTemp;
|
|
4107 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_back),
|
|
4108 |
mng_free_obj_general,
|
|
4109 |
mng_process_ani_back,
|
|
4110 |
&pTemp);
|
|
4111 |
if (iRetcode)
|
|
4112 |
return iRetcode;
|
|
4113 |
pBACK = (mng_ani_backp)pTemp;
|
|
4114 |
#else
|
|
4115 |
MNG_ALLOC (pData, pBACK, sizeof (mng_ani_back));
|
|
4116 |
|
|
4117 |
pBACK->sHeader.fCleanup = mng_free_ani_back;
|
|
4118 |
pBACK->sHeader.fProcess = mng_process_ani_back;
|
|
4119 |
#endif
|
|
4120 |
|
|
4121 |
mng_add_ani_object (pData, (mng_object_headerp)pBACK);
|
|
4122 |
|
|
4123 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4124 |
pBACK->iRed = iRed;
|
|
4125 |
pBACK->iGreen = iGreen;
|
|
4126 |
pBACK->iBlue = iBlue;
|
|
4127 |
pBACK->iMandatory = iMandatory;
|
|
4128 |
pBACK->iImageid = iImageid;
|
|
4129 |
pBACK->iTile = iTile;
|
|
4130 |
#else
|
|
4131 |
pBACK->iRed = pData->iBACKred;
|
|
4132 |
pBACK->iGreen = pData->iBACKgreen;
|
|
4133 |
pBACK->iBlue = pData->iBACKblue;
|
|
4134 |
pBACK->iMandatory = pData->iBACKmandatory;
|
|
4135 |
pBACK->iImageid = pData->iBACKimageid;
|
|
4136 |
pBACK->iTile = pData->iBACKtile;
|
|
4137 |
#endif
|
|
4138 |
}
|
|
4139 |
|
|
4140 |
#ifdef MNG_SUPPORT_TRACE
|
|
4141 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_BACK, MNG_LC_END);
|
|
4142 |
#endif
|
|
4143 |
|
|
4144 |
return MNG_NOERROR;
|
|
4145 |
}
|
|
4146 |
|
|
4147 |
/* ************************************************************************** */
|
|
4148 |
|
|
4149 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4150 |
mng_retcode mng_free_ani_back (mng_datap pData,
|
|
4151 |
mng_objectp pObject)
|
|
4152 |
{
|
|
4153 |
#ifdef MNG_SUPPORT_TRACE
|
|
4154 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_BACK, MNG_LC_START);
|
|
4155 |
#endif
|
|
4156 |
|
|
4157 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_back));
|
|
4158 |
|
|
4159 |
#ifdef MNG_SUPPORT_TRACE
|
|
4160 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_BACK, MNG_LC_END);
|
|
4161 |
#endif
|
|
4162 |
|
|
4163 |
return MNG_NOERROR;
|
|
4164 |
}
|
|
4165 |
#endif
|
|
4166 |
|
|
4167 |
/* ************************************************************************** */
|
|
4168 |
|
|
4169 |
mng_retcode mng_process_ani_back (mng_datap pData,
|
|
4170 |
mng_objectp pObject)
|
|
4171 |
{
|
|
4172 |
mng_ani_backp pBACK = (mng_ani_backp)pObject;
|
|
4173 |
|
|
4174 |
#ifdef MNG_SUPPORT_TRACE
|
|
4175 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BACK, MNG_LC_START);
|
|
4176 |
#endif
|
|
4177 |
|
|
4178 |
pData->iBACKred = pBACK->iRed;
|
|
4179 |
pData->iBACKgreen = pBACK->iGreen;
|
|
4180 |
pData->iBACKblue = pBACK->iBlue;
|
|
4181 |
pData->iBACKmandatory = pBACK->iMandatory;
|
|
4182 |
pData->iBACKimageid = pBACK->iImageid;
|
|
4183 |
pData->iBACKtile = pBACK->iTile;
|
|
4184 |
|
|
4185 |
#ifdef MNG_SUPPORT_TRACE
|
|
4186 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BACK, MNG_LC_END);
|
|
4187 |
#endif
|
|
4188 |
|
|
4189 |
return MNG_NOERROR;
|
|
4190 |
}
|
|
4191 |
#endif
|
|
4192 |
|
|
4193 |
/* ************************************************************************** */
|
|
4194 |
|
|
4195 |
#ifndef MNG_SKIPCHUNK_FRAM
|
|
4196 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4197 |
mng_retcode mng_create_ani_fram (mng_datap pData,
|
|
4198 |
mng_uint8 iFramemode,
|
|
4199 |
mng_uint8 iChangedelay,
|
|
4200 |
mng_uint32 iDelay,
|
|
4201 |
mng_uint8 iChangetimeout,
|
|
4202 |
mng_uint32 iTimeout,
|
|
4203 |
mng_uint8 iChangeclipping,
|
|
4204 |
mng_uint8 iCliptype,
|
|
4205 |
mng_int32 iClipl,
|
|
4206 |
mng_int32 iClipr,
|
|
4207 |
mng_int32 iClipt,
|
|
4208 |
mng_int32 iClipb)
|
|
4209 |
#else
|
|
4210 |
mng_retcode mng_create_ani_fram (mng_datap pData,
|
|
4211 |
mng_chunkp pChunk)
|
|
4212 |
#endif
|
|
4213 |
{
|
|
4214 |
mng_ani_framp pFRAM;
|
|
4215 |
mng_retcode iRetcode;
|
|
4216 |
|
|
4217 |
#ifdef MNG_SUPPORT_TRACE
|
|
4218 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_FRAM, MNG_LC_START);
|
|
4219 |
#endif
|
|
4220 |
|
|
4221 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4222 |
{
|
|
4223 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4224 |
mng_ptr pTemp;
|
|
4225 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_fram),
|
|
4226 |
mng_free_obj_general,
|
|
4227 |
mng_process_ani_fram,
|
|
4228 |
&pTemp);
|
|
4229 |
if (iRetcode)
|
|
4230 |
return iRetcode;
|
|
4231 |
pFRAM = (mng_ani_framp)pTemp;
|
|
4232 |
#else
|
|
4233 |
MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram));
|
|
4234 |
|
|
4235 |
pFRAM->sHeader.fCleanup = mng_free_ani_fram;
|
|
4236 |
pFRAM->sHeader.fProcess = mng_process_ani_fram;
|
|
4237 |
#endif
|
|
4238 |
|
|
4239 |
mng_add_ani_object (pData, (mng_object_headerp)pFRAM);
|
|
4240 |
|
|
4241 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4242 |
pFRAM->iFramemode = iFramemode;
|
|
4243 |
pFRAM->iChangedelay = iChangedelay;
|
|
4244 |
pFRAM->iDelay = iDelay;
|
|
4245 |
pFRAM->iChangetimeout = iChangetimeout;
|
|
4246 |
pFRAM->iTimeout = iTimeout;
|
|
4247 |
pFRAM->iChangeclipping = iChangeclipping;
|
|
4248 |
pFRAM->iCliptype = iCliptype;
|
|
4249 |
pFRAM->iClipl = iClipl;
|
|
4250 |
pFRAM->iClipr = iClipr;
|
|
4251 |
pFRAM->iClipt = iClipt;
|
|
4252 |
pFRAM->iClipb = iClipb;
|
|
4253 |
#else
|
|
4254 |
pFRAM->iFramemode = ((mng_framp)pChunk)->iMode;
|
|
4255 |
pFRAM->iChangedelay = ((mng_framp)pChunk)->iChangedelay;
|
|
4256 |
pFRAM->iDelay = ((mng_framp)pChunk)->iDelay;
|
|
4257 |
pFRAM->iChangetimeout = ((mng_framp)pChunk)->iChangetimeout;
|
|
4258 |
pFRAM->iTimeout = ((mng_framp)pChunk)->iTimeout;
|
|
4259 |
pFRAM->iChangeclipping = ((mng_framp)pChunk)->iChangeclipping;
|
|
4260 |
pFRAM->iCliptype = ((mng_framp)pChunk)->iBoundarytype;
|
|
4261 |
pFRAM->iClipl = ((mng_framp)pChunk)->iBoundaryl;
|
|
4262 |
pFRAM->iClipr = ((mng_framp)pChunk)->iBoundaryr;
|
|
4263 |
pFRAM->iClipt = ((mng_framp)pChunk)->iBoundaryt;
|
|
4264 |
pFRAM->iClipb = ((mng_framp)pChunk)->iBoundaryb;
|
|
4265 |
#endif
|
|
4266 |
}
|
|
4267 |
|
|
4268 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4269 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4270 |
iRetcode = mng_process_display_fram (pData, iFramemode,
|
|
4271 |
iChangedelay, iDelay,
|
|
4272 |
iChangetimeout, iTimeout,
|
|
4273 |
iChangeclipping, iCliptype,
|
|
4274 |
iClipl, iClipr,
|
|
4275 |
iClipt, iClipb);
|
|
4276 |
#else
|
|
4277 |
iRetcode = mng_process_display_fram (pData,
|
|
4278 |
((mng_framp)pChunk)->iMode,
|
|
4279 |
((mng_framp)pChunk)->iChangedelay,
|
|
4280 |
((mng_framp)pChunk)->iDelay,
|
|
4281 |
((mng_framp)pChunk)->iChangetimeout,
|
|
4282 |
((mng_framp)pChunk)->iTimeout,
|
|
4283 |
((mng_framp)pChunk)->iChangeclipping,
|
|
4284 |
((mng_framp)pChunk)->iBoundarytype,
|
|
4285 |
((mng_framp)pChunk)->iBoundaryl,
|
|
4286 |
((mng_framp)pChunk)->iBoundaryr,
|
|
4287 |
((mng_framp)pChunk)->iBoundaryt,
|
|
4288 |
((mng_framp)pChunk)->iBoundaryb);
|
|
4289 |
#endif
|
|
4290 |
#else
|
|
4291 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4292 |
pData->iTempFramemode = iFramemode;
|
|
4293 |
pData->iTempChangedelay = iChangedelay;
|
|
4294 |
pData->iTempDelay = iDelay;
|
|
4295 |
pData->iTempChangetimeout = iChangetimeout;
|
|
4296 |
pData->iTempTimeout = iTimeout;
|
|
4297 |
pData->iTempChangeclipping = iChangeclipping;
|
|
4298 |
pData->iTempCliptype = iCliptype;
|
|
4299 |
pData->iTempClipl = iClipl;
|
|
4300 |
pData->iTempClipr = iClipr;
|
|
4301 |
pData->iTempClipt = iClipt;
|
|
4302 |
pData->iTempClipb = iClipb;
|
|
4303 |
#else
|
|
4304 |
pData->iTempFramemode = ((mng_framp)pChunk)->iMode;
|
|
4305 |
pData->iTempChangedelay = ((mng_framp)pChunk)->iChangedelay;
|
|
4306 |
pData->iTempDelay = ((mng_framp)pChunk)->iDelay;
|
|
4307 |
pData->iTempChangetimeout = ((mng_framp)pChunk)->iChangetimeout;
|
|
4308 |
pData->iTempTimeout = ((mng_framp)pChunk)->iTimeout;
|
|
4309 |
pData->iTempChangeclipping = ((mng_framp)pChunk)->iChangeclipping;
|
|
4310 |
pData->iTempCliptype = ((mng_framp)pChunk)->iBoundarytype;
|
|
4311 |
pData->iTempClipl = ((mng_framp)pChunk)->iBoundaryl;
|
|
4312 |
pData->iTempClipr = ((mng_framp)pChunk)->iBoundaryr;
|
|
4313 |
pData->iTempClipt = ((mng_framp)pChunk)->iBoundaryt;
|
|
4314 |
pData->iTempClipb = ((mng_framp)pChunk)->iBoundaryb;
|
|
4315 |
#endif
|
|
4316 |
|
|
4317 |
iRetcode = mng_process_display_fram (pData);
|
|
4318 |
#endif
|
|
4319 |
|
|
4320 |
#ifdef MNG_SUPPORT_TRACE
|
|
4321 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_FRAM, MNG_LC_END);
|
|
4322 |
#endif
|
|
4323 |
|
|
4324 |
return iRetcode;
|
|
4325 |
}
|
|
4326 |
|
|
4327 |
/* ************************************************************************** */
|
|
4328 |
|
|
4329 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4330 |
mng_retcode mng_free_ani_fram (mng_datap pData,
|
|
4331 |
mng_objectp pObject)
|
|
4332 |
{
|
|
4333 |
#ifdef MNG_SUPPORT_TRACE
|
|
4334 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_FRAM, MNG_LC_START);
|
|
4335 |
#endif
|
|
4336 |
|
|
4337 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_fram));
|
|
4338 |
|
|
4339 |
#ifdef MNG_SUPPORT_TRACE
|
|
4340 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_FRAM, MNG_LC_END);
|
|
4341 |
#endif
|
|
4342 |
|
|
4343 |
return MNG_NOERROR;
|
|
4344 |
}
|
|
4345 |
#endif
|
|
4346 |
|
|
4347 |
/* ************************************************************************** */
|
|
4348 |
|
|
4349 |
mng_retcode mng_process_ani_fram (mng_datap pData,
|
|
4350 |
mng_objectp pObject)
|
|
4351 |
{
|
|
4352 |
mng_ani_framp pFRAM = (mng_ani_framp)pObject;
|
|
4353 |
mng_retcode iRetcode;
|
|
4354 |
|
|
4355 |
#ifdef MNG_SUPPORT_TRACE
|
|
4356 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_FRAM, MNG_LC_START);
|
|
4357 |
#endif
|
|
4358 |
|
|
4359 |
if (pData->iBreakpoint) /* previously broken ? */
|
|
4360 |
{
|
|
4361 |
iRetcode = mng_process_display_fram2 (pData);
|
|
4362 |
pData->iBreakpoint = 0; /* not again */
|
|
4363 |
}
|
|
4364 |
else
|
|
4365 |
{
|
|
4366 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4367 |
iRetcode = mng_process_display_fram (pData, pFRAM->iFramemode,
|
|
4368 |
pFRAM->iChangedelay, pFRAM->iDelay,
|
|
4369 |
pFRAM->iChangetimeout, pFRAM->iTimeout,
|
|
4370 |
pFRAM->iChangeclipping, pFRAM->iCliptype,
|
|
4371 |
pFRAM->iClipl, pFRAM->iClipr,
|
|
4372 |
pFRAM->iClipt, pFRAM->iClipb);
|
|
4373 |
#else
|
|
4374 |
pData->iTempFramemode = pFRAM->iFramemode;
|
|
4375 |
pData->iTempChangedelay = pFRAM->iChangedelay;
|
|
4376 |
pData->iTempDelay = pFRAM->iDelay;
|
|
4377 |
pData->iTempChangetimeout = pFRAM->iChangetimeout;
|
|
4378 |
pData->iTempTimeout = pFRAM->iTimeout;
|
|
4379 |
pData->iTempChangeclipping = pFRAM->iChangeclipping;
|
|
4380 |
pData->iTempCliptype = pFRAM->iCliptype;
|
|
4381 |
pData->iTempClipl = pFRAM->iClipl;
|
|
4382 |
pData->iTempClipr = pFRAM->iClipr;
|
|
4383 |
pData->iTempClipt = pFRAM->iClipt;
|
|
4384 |
pData->iTempClipb = pFRAM->iClipb;
|
|
4385 |
|
|
4386 |
iRetcode = mng_process_display_fram (pData);
|
|
4387 |
#endif
|
|
4388 |
}
|
|
4389 |
|
|
4390 |
#ifdef MNG_SUPPORT_TRACE
|
|
4391 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_FRAM, MNG_LC_END);
|
|
4392 |
#endif
|
|
4393 |
|
|
4394 |
return iRetcode;
|
|
4395 |
}
|
|
4396 |
#endif
|
|
4397 |
|
|
4398 |
/* ************************************************************************** */
|
|
4399 |
|
|
4400 |
#ifndef MNG_SKIPCHUNK_MOVE
|
|
4401 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4402 |
mng_retcode mng_create_ani_move (mng_datap pData,
|
|
4403 |
mng_uint16 iFirstid,
|
|
4404 |
mng_uint16 iLastid,
|
|
4405 |
mng_uint8 iType,
|
|
4406 |
mng_int32 iLocax,
|
|
4407 |
mng_int32 iLocay)
|
|
4408 |
#else
|
|
4409 |
mng_retcode mng_create_ani_move (mng_datap pData,
|
|
4410 |
mng_chunkp pChunk)
|
|
4411 |
#endif
|
|
4412 |
{
|
|
4413 |
mng_ani_movep pMOVE;
|
|
4414 |
mng_retcode iRetcode;
|
|
4415 |
|
|
4416 |
#ifdef MNG_SUPPORT_TRACE
|
|
4417 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_MOVE, MNG_LC_START);
|
|
4418 |
#endif
|
|
4419 |
|
|
4420 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4421 |
{
|
|
4422 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4423 |
mng_ptr pTemp;
|
|
4424 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_move),
|
|
4425 |
mng_free_obj_general,
|
|
4426 |
mng_process_ani_move,
|
|
4427 |
&pTemp);
|
|
4428 |
if (iRetcode)
|
|
4429 |
return iRetcode;
|
|
4430 |
pMOVE = (mng_ani_movep)pTemp;
|
|
4431 |
#else
|
|
4432 |
MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move));
|
|
4433 |
|
|
4434 |
pMOVE->sHeader.fCleanup = mng_free_ani_move;
|
|
4435 |
pMOVE->sHeader.fProcess = mng_process_ani_move;
|
|
4436 |
#endif
|
|
4437 |
|
|
4438 |
mng_add_ani_object (pData, (mng_object_headerp)pMOVE);
|
|
4439 |
|
|
4440 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4441 |
pMOVE->iFirstid = iFirstid;
|
|
4442 |
pMOVE->iLastid = iLastid;
|
|
4443 |
pMOVE->iType = iType;
|
|
4444 |
pMOVE->iLocax = iLocax;
|
|
4445 |
pMOVE->iLocay = iLocay;
|
|
4446 |
#else
|
|
4447 |
pMOVE->iFirstid = ((mng_movep)pChunk)->iFirstid;
|
|
4448 |
pMOVE->iLastid = ((mng_movep)pChunk)->iLastid;
|
|
4449 |
pMOVE->iType = ((mng_movep)pChunk)->iMovetype;
|
|
4450 |
pMOVE->iLocax = ((mng_movep)pChunk)->iMovex;
|
|
4451 |
pMOVE->iLocay = ((mng_movep)pChunk)->iMovey;
|
|
4452 |
#endif
|
|
4453 |
}
|
|
4454 |
|
|
4455 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4456 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4457 |
iRetcode = mng_process_display_move (pData, iFirstid, iLastid,
|
|
4458 |
iType, iLocax, iLocay);
|
|
4459 |
#else
|
|
4460 |
iRetcode = mng_process_display_move (pData,
|
|
4461 |
((mng_movep)pChunk)->iFirstid,
|
|
4462 |
((mng_movep)pChunk)->iLastid,
|
|
4463 |
((mng_movep)pChunk)->iMovetype,
|
|
4464 |
((mng_movep)pChunk)->iMovex,
|
|
4465 |
((mng_movep)pChunk)->iMovey);
|
|
4466 |
#endif
|
|
4467 |
#else
|
|
4468 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4469 |
pData->iMOVEfromid = iFirstid;
|
|
4470 |
pData->iMOVEtoid = iLastid;
|
|
4471 |
pData->iMOVEmovetype = iType;
|
|
4472 |
pData->iMOVEmovex = iLocax;
|
|
4473 |
pData->iMOVEmovey = iLocay;
|
|
4474 |
#else
|
|
4475 |
pData->iMOVEfromid = ((mng_movep)pChunk)->iFirstid;
|
|
4476 |
pData->iMOVEtoid = ((mng_movep)pChunk)->iLastid;
|
|
4477 |
pData->iMOVEmovetype = ((mng_movep)pChunk)->iMovetype;
|
|
4478 |
pData->iMOVEmovex = ((mng_movep)pChunk)->iMovex;
|
|
4479 |
pData->iMOVEmovey = ((mng_movep)pChunk)->iMovey;
|
|
4480 |
#endif
|
|
4481 |
|
|
4482 |
iRetcode = mng_process_display_move (pData);
|
|
4483 |
#endif
|
|
4484 |
|
|
4485 |
#ifdef MNG_SUPPORT_TRACE
|
|
4486 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_MOVE, MNG_LC_END);
|
|
4487 |
#endif
|
|
4488 |
|
|
4489 |
return iRetcode;
|
|
4490 |
}
|
|
4491 |
|
|
4492 |
/* ************************************************************************** */
|
|
4493 |
|
|
4494 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4495 |
mng_retcode mng_free_ani_move (mng_datap pData,
|
|
4496 |
mng_objectp pObject)
|
|
4497 |
{
|
|
4498 |
#ifdef MNG_SUPPORT_TRACE
|
|
4499 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_MOVE, MNG_LC_START);
|
|
4500 |
#endif
|
|
4501 |
|
|
4502 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_move));
|
|
4503 |
|
|
4504 |
#ifdef MNG_SUPPORT_TRACE
|
|
4505 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_MOVE, MNG_LC_END);
|
|
4506 |
#endif
|
|
4507 |
|
|
4508 |
return MNG_NOERROR;
|
|
4509 |
}
|
|
4510 |
#endif
|
|
4511 |
|
|
4512 |
/* ************************************************************************** */
|
|
4513 |
|
|
4514 |
mng_retcode mng_process_ani_move (mng_datap pData,
|
|
4515 |
mng_objectp pObject)
|
|
4516 |
{
|
|
4517 |
mng_retcode iRetcode;
|
|
4518 |
mng_ani_movep pMOVE = (mng_ani_movep)pObject;
|
|
4519 |
|
|
4520 |
#ifdef MNG_SUPPORT_TRACE
|
|
4521 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MOVE, MNG_LC_START);
|
|
4522 |
#endif
|
|
4523 |
/* re-process the MOVE chunk */
|
|
4524 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4525 |
iRetcode = mng_process_display_move (pData, pMOVE->iFirstid, pMOVE->iLastid,
|
|
4526 |
pMOVE->iType, pMOVE->iLocax, pMOVE->iLocay);
|
|
4527 |
#else
|
|
4528 |
pData->iMOVEfromid = pMOVE->iFirstid;
|
|
4529 |
pData->iMOVEtoid = pMOVE->iLastid;
|
|
4530 |
pData->iMOVEmovetype = pMOVE->iType;
|
|
4531 |
pData->iMOVEmovex = pMOVE->iLocax;
|
|
4532 |
pData->iMOVEmovey = pMOVE->iLocay;
|
|
4533 |
|
|
4534 |
iRetcode = mng_process_display_move (pData);
|
|
4535 |
#endif
|
|
4536 |
|
|
4537 |
#ifdef MNG_SUPPORT_TRACE
|
|
4538 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MOVE, MNG_LC_END);
|
|
4539 |
#endif
|
|
4540 |
|
|
4541 |
return iRetcode;
|
|
4542 |
}
|
|
4543 |
#endif
|
|
4544 |
|
|
4545 |
/* ************************************************************************** */
|
|
4546 |
|
|
4547 |
#ifndef MNG_SKIPCHUNK_CLIP
|
|
4548 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4549 |
mng_retcode mng_create_ani_clip (mng_datap pData,
|
|
4550 |
mng_uint16 iFirstid,
|
|
4551 |
mng_uint16 iLastid,
|
|
4552 |
mng_uint8 iType,
|
|
4553 |
mng_int32 iClipl,
|
|
4554 |
mng_int32 iClipr,
|
|
4555 |
mng_int32 iClipt,
|
|
4556 |
mng_int32 iClipb)
|
|
4557 |
#else
|
|
4558 |
mng_retcode mng_create_ani_clip (mng_datap pData,
|
|
4559 |
mng_chunkp pChunk)
|
|
4560 |
#endif
|
|
4561 |
{
|
|
4562 |
mng_ani_clipp pCLIP;
|
|
4563 |
mng_retcode iRetcode;
|
|
4564 |
|
|
4565 |
#ifdef MNG_SUPPORT_TRACE
|
|
4566 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLIP, MNG_LC_START);
|
|
4567 |
#endif
|
|
4568 |
|
|
4569 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4570 |
{
|
|
4571 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4572 |
mng_ptr pTemp;
|
|
4573 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_clip),
|
|
4574 |
mng_free_obj_general,
|
|
4575 |
mng_process_ani_clip,
|
|
4576 |
&pTemp);
|
|
4577 |
if (iRetcode)
|
|
4578 |
return iRetcode;
|
|
4579 |
pCLIP = (mng_ani_clipp)pTemp;
|
|
4580 |
#else
|
|
4581 |
MNG_ALLOC (pData, pCLIP, sizeof (mng_ani_clip));
|
|
4582 |
|
|
4583 |
pCLIP->sHeader.fCleanup = mng_free_ani_clip;
|
|
4584 |
pCLIP->sHeader.fProcess = mng_process_ani_clip;
|
|
4585 |
#endif
|
|
4586 |
|
|
4587 |
mng_add_ani_object (pData, (mng_object_headerp)pCLIP);
|
|
4588 |
|
|
4589 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4590 |
pCLIP->iFirstid = iFirstid;
|
|
4591 |
pCLIP->iLastid = iLastid;
|
|
4592 |
pCLIP->iType = iType;
|
|
4593 |
pCLIP->iClipl = iClipl;
|
|
4594 |
pCLIP->iClipr = iClipr;
|
|
4595 |
pCLIP->iClipt = iClipt;
|
|
4596 |
pCLIP->iClipb = iClipb;
|
|
4597 |
#else
|
|
4598 |
pCLIP->iFirstid = ((mng_clipp)pChunk)->iFirstid;
|
|
4599 |
pCLIP->iLastid = ((mng_clipp)pChunk)->iLastid;
|
|
4600 |
pCLIP->iType = ((mng_clipp)pChunk)->iCliptype;
|
|
4601 |
pCLIP->iClipl = ((mng_clipp)pChunk)->iClipl;
|
|
4602 |
pCLIP->iClipr = ((mng_clipp)pChunk)->iClipr;
|
|
4603 |
pCLIP->iClipt = ((mng_clipp)pChunk)->iClipt;
|
|
4604 |
pCLIP->iClipb = ((mng_clipp)pChunk)->iClipb;
|
|
4605 |
#endif
|
|
4606 |
}
|
|
4607 |
|
|
4608 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4609 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4610 |
iRetcode = mng_process_display_clip (pData, iFirstid, iLastid,
|
|
4611 |
iType, iClipl, iClipr,
|
|
4612 |
iClipt, iClipb);
|
|
4613 |
#else
|
|
4614 |
iRetcode = mng_process_display_clip (pData,
|
|
4615 |
((mng_clipp)pChunk)->iFirstid,
|
|
4616 |
((mng_clipp)pChunk)->iLastid,
|
|
4617 |
((mng_clipp)pChunk)->iCliptype,
|
|
4618 |
((mng_clipp)pChunk)->iClipl,
|
|
4619 |
((mng_clipp)pChunk)->iClipr,
|
|
4620 |
((mng_clipp)pChunk)->iClipt,
|
|
4621 |
((mng_clipp)pChunk)->iClipb);
|
|
4622 |
#endif
|
|
4623 |
#else
|
|
4624 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4625 |
pData->iCLIPfromid = iFirstid;
|
|
4626 |
pData->iCLIPtoid = iLastid;
|
|
4627 |
pData->iCLIPcliptype = iType;
|
|
4628 |
pData->iCLIPclipl = iClipl;
|
|
4629 |
pData->iCLIPclipr = iClipr;
|
|
4630 |
pData->iCLIPclipt = iClipt;
|
|
4631 |
pData->iCLIPclipb = iClipb;
|
|
4632 |
#else
|
|
4633 |
pData->iCLIPfromid = ((mng_clipp)pChunk)->iFirstid;
|
|
4634 |
pData->iCLIPtoid = ((mng_clipp)pChunk)->iLastid;
|
|
4635 |
pData->iCLIPcliptype = ((mng_clipp)pChunk)->iCliptype;
|
|
4636 |
pData->iCLIPclipl = ((mng_clipp)pChunk)->iClipl;
|
|
4637 |
pData->iCLIPclipr = ((mng_clipp)pChunk)->iClipr;
|
|
4638 |
pData->iCLIPclipt = ((mng_clipp)pChunk)->iClipt;
|
|
4639 |
pData->iCLIPclipb = ((mng_clipp)pChunk)->iClipb;
|
|
4640 |
#endif
|
|
4641 |
|
|
4642 |
iRetcode = mng_process_display_clip (pData);
|
|
4643 |
#endif
|
|
4644 |
|
|
4645 |
#ifdef MNG_SUPPORT_TRACE
|
|
4646 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLIP, MNG_LC_END);
|
|
4647 |
#endif
|
|
4648 |
|
|
4649 |
return iRetcode;
|
|
4650 |
}
|
|
4651 |
|
|
4652 |
/* ************************************************************************** */
|
|
4653 |
|
|
4654 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4655 |
mng_retcode mng_free_ani_clip (mng_datap pData,
|
|
4656 |
mng_objectp pObject)
|
|
4657 |
{
|
|
4658 |
#ifdef MNG_SUPPORT_TRACE
|
|
4659 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_CLIP, MNG_LC_START);
|
|
4660 |
#endif
|
|
4661 |
|
|
4662 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_clip));
|
|
4663 |
|
|
4664 |
#ifdef MNG_SUPPORT_TRACE
|
|
4665 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_CLIP, MNG_LC_END);
|
|
4666 |
#endif
|
|
4667 |
|
|
4668 |
return MNG_NOERROR;
|
|
4669 |
}
|
|
4670 |
#endif
|
|
4671 |
|
|
4672 |
/* ************************************************************************** */
|
|
4673 |
|
|
4674 |
mng_retcode mng_process_ani_clip (mng_datap pData,
|
|
4675 |
mng_objectp pObject)
|
|
4676 |
{
|
|
4677 |
mng_retcode iRetcode;
|
|
4678 |
mng_ani_clipp pCLIP = (mng_ani_clipp)pObject;
|
|
4679 |
|
|
4680 |
#ifdef MNG_SUPPORT_TRACE
|
|
4681 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLIP, MNG_LC_START);
|
|
4682 |
#endif
|
|
4683 |
/* re-process the CLIP chunk */
|
|
4684 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
4685 |
iRetcode = mng_process_display_clip (pData, pCLIP->iFirstid, pCLIP->iLastid,
|
|
4686 |
pCLIP->iType, pCLIP->iClipl, pCLIP->iClipr,
|
|
4687 |
pCLIP->iClipt, pCLIP->iClipb);
|
|
4688 |
#else
|
|
4689 |
pData->iCLIPfromid = pCLIP->iFirstid;
|
|
4690 |
pData->iCLIPtoid = pCLIP->iLastid;
|
|
4691 |
pData->iCLIPcliptype = pCLIP->iType;
|
|
4692 |
pData->iCLIPclipl = pCLIP->iClipl;
|
|
4693 |
pData->iCLIPclipr = pCLIP->iClipr;
|
|
4694 |
pData->iCLIPclipt = pCLIP->iClipt;
|
|
4695 |
pData->iCLIPclipb = pCLIP->iClipb;
|
|
4696 |
|
|
4697 |
iRetcode = mng_process_display_clip (pData);
|
|
4698 |
#endif
|
|
4699 |
|
|
4700 |
#ifdef MNG_SUPPORT_TRACE
|
|
4701 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLIP, MNG_LC_END);
|
|
4702 |
#endif
|
|
4703 |
|
|
4704 |
return iRetcode;
|
|
4705 |
}
|
|
4706 |
#endif
|
|
4707 |
|
|
4708 |
/* ************************************************************************** */
|
|
4709 |
|
|
4710 |
#ifndef MNG_SKIPCHUNK_SHOW
|
|
4711 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4712 |
mng_retcode mng_create_ani_show (mng_datap pData,
|
|
4713 |
mng_uint16 iFirstid,
|
|
4714 |
mng_uint16 iLastid,
|
|
4715 |
mng_uint8 iMode)
|
|
4716 |
#else
|
|
4717 |
mng_retcode mng_create_ani_show (mng_datap pData)
|
|
4718 |
#endif
|
|
4719 |
{
|
|
4720 |
mng_ani_showp pSHOW;
|
|
4721 |
|
|
4722 |
#ifdef MNG_SUPPORT_TRACE
|
|
4723 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SHOW, MNG_LC_START);
|
|
4724 |
#endif
|
|
4725 |
|
|
4726 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4727 |
{
|
|
4728 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4729 |
mng_ptr pTemp;
|
|
4730 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_show),
|
|
4731 |
mng_free_obj_general,
|
|
4732 |
mng_process_ani_show,
|
|
4733 |
&pTemp);
|
|
4734 |
if (iRetcode)
|
|
4735 |
return iRetcode;
|
|
4736 |
pSHOW = (mng_ani_showp)pTemp;
|
|
4737 |
#else
|
|
4738 |
MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show));
|
|
4739 |
|
|
4740 |
pSHOW->sHeader.fCleanup = mng_free_ani_show;
|
|
4741 |
pSHOW->sHeader.fProcess = mng_process_ani_show;
|
|
4742 |
#endif
|
|
4743 |
|
|
4744 |
mng_add_ani_object (pData, (mng_object_headerp)pSHOW);
|
|
4745 |
|
|
4746 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4747 |
pSHOW->iFirstid = iFirstid;
|
|
4748 |
pSHOW->iLastid = iLastid;
|
|
4749 |
pSHOW->iMode = iMode;
|
|
4750 |
#else
|
|
4751 |
pSHOW->iFirstid = pData->iSHOWfromid;
|
|
4752 |
pSHOW->iLastid = pData->iSHOWtoid;
|
|
4753 |
pSHOW->iMode = pData->iSHOWmode;
|
|
4754 |
#endif
|
|
4755 |
}
|
|
4756 |
|
|
4757 |
#ifdef MNG_SUPPORT_TRACE
|
|
4758 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SHOW, MNG_LC_END);
|
|
4759 |
#endif
|
|
4760 |
|
|
4761 |
return MNG_NOERROR;
|
|
4762 |
}
|
|
4763 |
|
|
4764 |
/* ************************************************************************** */
|
|
4765 |
|
|
4766 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4767 |
mng_retcode mng_free_ani_show (mng_datap pData,
|
|
4768 |
mng_objectp pObject)
|
|
4769 |
{
|
|
4770 |
#ifdef MNG_SUPPORT_TRACE
|
|
4771 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SHOW, MNG_LC_START);
|
|
4772 |
#endif
|
|
4773 |
|
|
4774 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_show));
|
|
4775 |
|
|
4776 |
#ifdef MNG_SUPPORT_TRACE
|
|
4777 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SHOW, MNG_LC_END);
|
|
4778 |
#endif
|
|
4779 |
|
|
4780 |
return MNG_NOERROR;
|
|
4781 |
}
|
|
4782 |
#endif
|
|
4783 |
|
|
4784 |
/* ************************************************************************** */
|
|
4785 |
|
|
4786 |
mng_retcode mng_process_ani_show (mng_datap pData,
|
|
4787 |
mng_objectp pObject)
|
|
4788 |
{
|
|
4789 |
mng_retcode iRetcode;
|
|
4790 |
mng_ani_showp pSHOW = (mng_ani_showp)pObject;
|
|
4791 |
|
|
4792 |
#ifdef MNG_SUPPORT_TRACE
|
|
4793 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SHOW, MNG_LC_START);
|
|
4794 |
#endif
|
|
4795 |
|
|
4796 |
if (pData->iBreakpoint) /* returning from breakpoint ? */
|
|
4797 |
{
|
|
4798 |
iRetcode = mng_process_display_show (pData);
|
|
4799 |
}
|
|
4800 |
else
|
|
4801 |
{ /* "re-run" SHOW chunk */
|
|
4802 |
pData->iSHOWmode = pSHOW->iMode;
|
|
4803 |
pData->iSHOWfromid = pSHOW->iFirstid;
|
|
4804 |
pData->iSHOWtoid = pSHOW->iLastid;
|
|
4805 |
|
|
4806 |
iRetcode = mng_process_display_show (pData);
|
|
4807 |
}
|
|
4808 |
|
|
4809 |
#ifdef MNG_SUPPORT_TRACE
|
|
4810 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SHOW, MNG_LC_END);
|
|
4811 |
#endif
|
|
4812 |
|
|
4813 |
return iRetcode;
|
|
4814 |
}
|
|
4815 |
#endif
|
|
4816 |
|
|
4817 |
/* ************************************************************************** */
|
|
4818 |
|
|
4819 |
#ifndef MNG_SKIPCHUNK_TERM
|
|
4820 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4821 |
mng_retcode mng_create_ani_term (mng_datap pData,
|
|
4822 |
mng_uint8 iTermaction,
|
|
4823 |
mng_uint8 iIteraction,
|
|
4824 |
mng_uint32 iDelay,
|
|
4825 |
mng_uint32 iItermax)
|
|
4826 |
#else
|
|
4827 |
mng_retcode mng_create_ani_term (mng_datap pData,
|
|
4828 |
mng_chunkp pChunk)
|
|
4829 |
#endif
|
|
4830 |
{
|
|
4831 |
mng_ani_termp pTERM;
|
|
4832 |
|
|
4833 |
#ifdef MNG_SUPPORT_TRACE
|
|
4834 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_TERM, MNG_LC_START);
|
|
4835 |
#endif
|
|
4836 |
|
|
4837 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4838 |
{
|
|
4839 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4840 |
mng_ptr pTemp;
|
|
4841 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_term),
|
|
4842 |
mng_free_obj_general,
|
|
4843 |
mng_process_ani_term,
|
|
4844 |
&pTemp);
|
|
4845 |
if (iRetcode)
|
|
4846 |
return iRetcode;
|
|
4847 |
pTERM = (mng_ani_termp)pTemp;
|
|
4848 |
#else
|
|
4849 |
MNG_ALLOC (pData, pTERM, sizeof (mng_ani_term));
|
|
4850 |
|
|
4851 |
pTERM->sHeader.fCleanup = mng_free_ani_term;
|
|
4852 |
pTERM->sHeader.fProcess = mng_process_ani_term;
|
|
4853 |
#endif
|
|
4854 |
|
|
4855 |
mng_add_ani_object (pData, (mng_object_headerp)pTERM);
|
|
4856 |
|
|
4857 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
4858 |
pTERM->iTermaction = iTermaction;
|
|
4859 |
pTERM->iIteraction = iIteraction;
|
|
4860 |
pTERM->iDelay = iDelay;
|
|
4861 |
pTERM->iItermax = iItermax;
|
|
4862 |
#else
|
|
4863 |
pTERM->iTermaction = ((mng_termp)pChunk)->iTermaction;
|
|
4864 |
pTERM->iIteraction = ((mng_termp)pChunk)->iIteraction;
|
|
4865 |
pTERM->iDelay = ((mng_termp)pChunk)->iDelay;
|
|
4866 |
pTERM->iItermax = ((mng_termp)pChunk)->iItermax;
|
|
4867 |
#endif
|
|
4868 |
}
|
|
4869 |
|
|
4870 |
#ifdef MNG_SUPPORT_TRACE
|
|
4871 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_TERM, MNG_LC_END);
|
|
4872 |
#endif
|
|
4873 |
|
|
4874 |
return MNG_NOERROR;
|
|
4875 |
}
|
|
4876 |
|
|
4877 |
/* ************************************************************************** */
|
|
4878 |
|
|
4879 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4880 |
mng_retcode mng_free_ani_term (mng_datap pData,
|
|
4881 |
mng_objectp pObject)
|
|
4882 |
{
|
|
4883 |
#ifdef MNG_SUPPORT_TRACE
|
|
4884 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_TERM, MNG_LC_START);
|
|
4885 |
#endif
|
|
4886 |
|
|
4887 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_term));
|
|
4888 |
|
|
4889 |
#ifdef MNG_SUPPORT_TRACE
|
|
4890 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_TERM, MNG_LC_END);
|
|
4891 |
#endif
|
|
4892 |
|
|
4893 |
return MNG_NOERROR;
|
|
4894 |
}
|
|
4895 |
#endif
|
|
4896 |
|
|
4897 |
/* ************************************************************************** */
|
|
4898 |
|
|
4899 |
mng_retcode mng_process_ani_term (mng_datap pData,
|
|
4900 |
mng_objectp pObject)
|
|
4901 |
{
|
|
4902 |
#ifdef MNG_SUPPORT_TRACE
|
|
4903 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TERM, MNG_LC_START);
|
|
4904 |
#endif
|
|
4905 |
|
|
4906 |
/* dummy: no action required! */
|
|
4907 |
|
|
4908 |
#ifdef MNG_SUPPORT_TRACE
|
|
4909 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TERM, MNG_LC_END);
|
|
4910 |
#endif
|
|
4911 |
|
|
4912 |
return MNG_NOERROR;
|
|
4913 |
}
|
|
4914 |
#endif
|
|
4915 |
|
|
4916 |
/* ************************************************************************** */
|
|
4917 |
|
|
4918 |
#ifndef MNG_SKIPCHUNK_SAVE
|
|
4919 |
mng_retcode mng_create_ani_save (mng_datap pData)
|
|
4920 |
{
|
|
4921 |
mng_ani_savep pSAVE;
|
|
4922 |
|
|
4923 |
#ifdef MNG_SUPPORT_TRACE
|
|
4924 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SAVE, MNG_LC_START);
|
|
4925 |
#endif
|
|
4926 |
|
|
4927 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
4928 |
{
|
|
4929 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
4930 |
mng_ptr pTemp;
|
|
4931 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_save),
|
|
4932 |
mng_free_obj_general,
|
|
4933 |
mng_process_ani_save,
|
|
4934 |
&pTemp);
|
|
4935 |
if (iRetcode)
|
|
4936 |
return iRetcode;
|
|
4937 |
pSAVE = (mng_ani_savep)pTemp;
|
|
4938 |
#else
|
|
4939 |
MNG_ALLOC (pData, pSAVE, sizeof (mng_ani_save));
|
|
4940 |
|
|
4941 |
pSAVE->sHeader.fCleanup = mng_free_ani_save;
|
|
4942 |
pSAVE->sHeader.fProcess = mng_process_ani_save;
|
|
4943 |
#endif
|
|
4944 |
|
|
4945 |
mng_add_ani_object (pData, (mng_object_headerp)pSAVE);
|
|
4946 |
}
|
|
4947 |
|
|
4948 |
#ifdef MNG_SUPPORT_TRACE
|
|
4949 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SAVE, MNG_LC_END);
|
|
4950 |
#endif
|
|
4951 |
|
|
4952 |
return MNG_NOERROR;
|
|
4953 |
}
|
|
4954 |
|
|
4955 |
/* ************************************************************************** */
|
|
4956 |
|
|
4957 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
4958 |
mng_retcode mng_free_ani_save (mng_datap pData,
|
|
4959 |
mng_objectp pObject)
|
|
4960 |
{
|
|
4961 |
#ifdef MNG_SUPPORT_TRACE
|
|
4962 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SAVE, MNG_LC_START);
|
|
4963 |
#endif
|
|
4964 |
|
|
4965 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_save));
|
|
4966 |
|
|
4967 |
#ifdef MNG_SUPPORT_TRACE
|
|
4968 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SAVE, MNG_LC_END);
|
|
4969 |
#endif
|
|
4970 |
|
|
4971 |
return MNG_NOERROR;
|
|
4972 |
}
|
|
4973 |
#endif
|
|
4974 |
|
|
4975 |
/* ************************************************************************** */
|
|
4976 |
|
|
4977 |
mng_retcode mng_process_ani_save (mng_datap pData,
|
|
4978 |
mng_objectp pObject)
|
|
4979 |
{
|
|
4980 |
mng_retcode iRetcode;
|
|
4981 |
|
|
4982 |
#ifdef MNG_SUPPORT_TRACE
|
|
4983 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SAVE, MNG_LC_START);
|
|
4984 |
#endif
|
|
4985 |
|
|
4986 |
iRetcode = mng_process_display_save (pData);
|
|
4987 |
|
|
4988 |
if (iRetcode) /* on error bail out */
|
|
4989 |
return iRetcode;
|
|
4990 |
|
|
4991 |
#ifdef MNG_SUPPORT_TRACE
|
|
4992 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SAVE, MNG_LC_END);
|
|
4993 |
#endif
|
|
4994 |
|
|
4995 |
return MNG_NOERROR;
|
|
4996 |
}
|
|
4997 |
#endif
|
|
4998 |
|
|
4999 |
/* ************************************************************************** */
|
|
5000 |
/* ************************************************************************** */
|
|
5001 |
|
|
5002 |
#ifndef MNG_SKIPCHUNK_SEEK
|
|
5003 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5004 |
mng_retcode mng_create_ani_seek (mng_datap pData,
|
|
5005 |
mng_uint32 iSegmentnamesize,
|
|
5006 |
mng_pchar zSegmentname)
|
|
5007 |
#else
|
|
5008 |
mng_retcode mng_create_ani_seek (mng_datap pData,
|
|
5009 |
mng_chunkp pChunk)
|
|
5010 |
#endif
|
|
5011 |
{
|
|
5012 |
mng_ani_seekp pSEEK;
|
|
5013 |
|
|
5014 |
#ifdef MNG_SUPPORT_TRACE
|
|
5015 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SEEK, MNG_LC_START);
|
|
5016 |
#endif
|
|
5017 |
|
|
5018 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5019 |
{
|
|
5020 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5021 |
mng_ptr pTemp;
|
|
5022 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_seek),
|
|
5023 |
mng_free_ani_seek,
|
|
5024 |
mng_process_ani_seek,
|
|
5025 |
&pTemp);
|
|
5026 |
if (iRetcode)
|
|
5027 |
return iRetcode;
|
|
5028 |
pSEEK = (mng_ani_seekp)pTemp;
|
|
5029 |
#else
|
|
5030 |
MNG_ALLOC (pData, pSEEK, sizeof (mng_ani_seek));
|
|
5031 |
|
|
5032 |
pSEEK->sHeader.fCleanup = mng_free_ani_seek;
|
|
5033 |
pSEEK->sHeader.fProcess = mng_process_ani_seek;
|
|
5034 |
#endif
|
|
5035 |
|
|
5036 |
mng_add_ani_object (pData, (mng_object_headerp)pSEEK);
|
|
5037 |
|
|
5038 |
pData->pLastseek = (mng_objectp)pSEEK;
|
|
5039 |
|
|
5040 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5041 |
pSEEK->iSegmentnamesize = iSegmentnamesize;
|
|
5042 |
if (iSegmentnamesize)
|
|
5043 |
{
|
|
5044 |
MNG_ALLOC (pData, pSEEK->zSegmentname, iSegmentnamesize + 1);
|
|
5045 |
MNG_COPY (pSEEK->zSegmentname, zSegmentname, iSegmentnamesize);
|
|
5046 |
}
|
|
5047 |
#else
|
|
5048 |
pSEEK->iSegmentnamesize = ((mng_seekp)pChunk)->iNamesize;
|
|
5049 |
if (pSEEK->iSegmentnamesize)
|
|
5050 |
{
|
|
5051 |
MNG_ALLOC (pData, pSEEK->zSegmentname, pSEEK->iSegmentnamesize + 1);
|
|
5052 |
MNG_COPY (pSEEK->zSegmentname, ((mng_seekp)pChunk)->zName, pSEEK->iSegmentnamesize);
|
|
5053 |
}
|
|
5054 |
#endif
|
|
5055 |
}
|
|
5056 |
|
|
5057 |
#ifdef MNG_SUPPORT_TRACE
|
|
5058 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_SEEK, MNG_LC_END);
|
|
5059 |
#endif
|
|
5060 |
|
|
5061 |
return MNG_NOERROR;
|
|
5062 |
}
|
|
5063 |
|
|
5064 |
/* ************************************************************************** */
|
|
5065 |
|
|
5066 |
mng_retcode mng_free_ani_seek (mng_datap pData,
|
|
5067 |
mng_objectp pObject)
|
|
5068 |
{
|
|
5069 |
mng_ani_seekp pSEEK = (mng_ani_seekp)pObject;
|
|
5070 |
|
|
5071 |
#ifdef MNG_SUPPORT_TRACE
|
|
5072 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SEEK, MNG_LC_START);
|
|
5073 |
#endif
|
|
5074 |
|
|
5075 |
if (pSEEK->iSegmentnamesize)
|
|
5076 |
MNG_FREEX (pData, pSEEK->zSegmentname, pSEEK->iSegmentnamesize + 1);
|
|
5077 |
|
|
5078 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5079 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_seek));
|
|
5080 |
#endif
|
|
5081 |
|
|
5082 |
#ifdef MNG_SUPPORT_TRACE
|
|
5083 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_SEEK, MNG_LC_END);
|
|
5084 |
#endif
|
|
5085 |
|
|
5086 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5087 |
return MNG_NOERROR;
|
|
5088 |
#else
|
|
5089 |
return mng_free_obj_general(pData, pObject);
|
|
5090 |
#endif
|
|
5091 |
}
|
|
5092 |
|
|
5093 |
/* ************************************************************************** */
|
|
5094 |
|
|
5095 |
mng_retcode mng_process_ani_seek (mng_datap pData,
|
|
5096 |
mng_objectp pObject)
|
|
5097 |
{
|
|
5098 |
mng_ani_seekp pSEEK = (mng_ani_seekp)pObject;
|
|
5099 |
mng_retcode iRetcode;
|
|
5100 |
|
|
5101 |
#ifdef MNG_SUPPORT_TRACE
|
|
5102 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SEEK, MNG_LC_START);
|
|
5103 |
#endif
|
|
5104 |
|
|
5105 |
#ifdef MNG_SUPPORT_DYNAMICMNG
|
|
5106 |
if (!pData->bStopafterseek) /* can we really process this one ? */
|
|
5107 |
#endif
|
|
5108 |
{
|
|
5109 |
pData->pLastseek = pObject;
|
|
5110 |
|
|
5111 |
if (pData->fProcessseek) /* inform the app ? */
|
|
5112 |
{
|
|
5113 |
mng_bool bOke;
|
|
5114 |
mng_pchar zName;
|
|
5115 |
|
|
5116 |
MNG_ALLOC (pData, zName, pSEEK->iSegmentnamesize + 1);
|
|
5117 |
|
|
5118 |
if (pSEEK->iSegmentnamesize)
|
|
5119 |
MNG_COPY (zName, pSEEK->zSegmentname, pSEEK->iSegmentnamesize);
|
|
5120 |
|
|
5121 |
bOke = pData->fProcessseek ((mng_handle)pData, zName);
|
|
5122 |
|
|
5123 |
MNG_FREEX (pData, zName, pSEEK->iSegmentnamesize + 1);
|
|
5124 |
|
|
5125 |
if (!bOke)
|
|
5126 |
MNG_ERROR (pData, MNG_APPMISCERROR);
|
|
5127 |
}
|
|
5128 |
}
|
|
5129 |
|
|
5130 |
iRetcode = mng_process_display_seek (pData);
|
|
5131 |
|
|
5132 |
if (iRetcode) /* on error bail out */
|
|
5133 |
return iRetcode;
|
|
5134 |
|
|
5135 |
#ifdef MNG_SUPPORT_TRACE
|
|
5136 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SEEK, MNG_LC_END);
|
|
5137 |
#endif
|
|
5138 |
|
|
5139 |
return MNG_NOERROR;
|
|
5140 |
}
|
|
5141 |
#endif
|
|
5142 |
|
|
5143 |
/* ************************************************************************** */
|
|
5144 |
|
|
5145 |
#ifndef MNG_NO_DELTA_PNG
|
|
5146 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5147 |
mng_retcode mng_create_ani_dhdr (mng_datap pData,
|
|
5148 |
mng_uint16 iObjectid,
|
|
5149 |
mng_uint8 iImagetype,
|
|
5150 |
mng_uint8 iDeltatype,
|
|
5151 |
mng_uint32 iBlockwidth,
|
|
5152 |
mng_uint32 iBlockheight,
|
|
5153 |
mng_uint32 iBlockx,
|
|
5154 |
mng_uint32 iBlocky)
|
|
5155 |
#else
|
|
5156 |
mng_retcode mng_create_ani_dhdr (mng_datap pData,
|
|
5157 |
mng_chunkp pChunk)
|
|
5158 |
#endif
|
|
5159 |
{
|
|
5160 |
mng_ani_dhdrp pDHDR;
|
|
5161 |
mng_retcode iRetcode;
|
|
5162 |
|
|
5163 |
#ifdef MNG_SUPPORT_TRACE
|
|
5164 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_DHDR, MNG_LC_START);
|
|
5165 |
#endif
|
|
5166 |
|
|
5167 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5168 |
{
|
|
5169 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5170 |
mng_ptr pTemp;
|
|
5171 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_dhdr),
|
|
5172 |
mng_free_obj_general,
|
|
5173 |
mng_process_ani_dhdr,
|
|
5174 |
&pTemp);
|
|
5175 |
if (iRetcode)
|
|
5176 |
return iRetcode;
|
|
5177 |
pDHDR = (mng_ani_dhdrp)pTemp;
|
|
5178 |
#else
|
|
5179 |
MNG_ALLOC (pData, pDHDR, sizeof (mng_ani_dhdr));
|
|
5180 |
|
|
5181 |
pDHDR->sHeader.fCleanup = mng_free_ani_dhdr;
|
|
5182 |
pDHDR->sHeader.fProcess = mng_process_ani_dhdr;
|
|
5183 |
#endif
|
|
5184 |
|
|
5185 |
mng_add_ani_object (pData, (mng_object_headerp)pDHDR);
|
|
5186 |
|
|
5187 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5188 |
pDHDR->iObjectid = iObjectid;
|
|
5189 |
pDHDR->iImagetype = iImagetype;
|
|
5190 |
pDHDR->iDeltatype = iDeltatype;
|
|
5191 |
pDHDR->iBlockwidth = iBlockwidth;
|
|
5192 |
pDHDR->iBlockheight = iBlockheight;
|
|
5193 |
pDHDR->iBlockx = iBlockx;
|
|
5194 |
pDHDR->iBlocky = iBlocky;
|
|
5195 |
#else
|
|
5196 |
pDHDR->iObjectid = ((mng_dhdrp)pChunk)->iObjectid;
|
|
5197 |
pDHDR->iImagetype = ((mng_dhdrp)pChunk)->iImagetype;
|
|
5198 |
pDHDR->iDeltatype = ((mng_dhdrp)pChunk)->iDeltatype;
|
|
5199 |
pDHDR->iBlockwidth = ((mng_dhdrp)pChunk)->iBlockwidth;
|
|
5200 |
pDHDR->iBlockheight = ((mng_dhdrp)pChunk)->iBlockheight;
|
|
5201 |
pDHDR->iBlockx = ((mng_dhdrp)pChunk)->iBlockx;
|
|
5202 |
pDHDR->iBlocky = ((mng_dhdrp)pChunk)->iBlocky;
|
|
5203 |
#endif
|
|
5204 |
}
|
|
5205 |
|
|
5206 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5207 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5208 |
iRetcode = mng_process_display_dhdr (pData, iObjectid,
|
|
5209 |
iImagetype, iDeltatype,
|
|
5210 |
iBlockwidth, iBlockheight,
|
|
5211 |
iBlockx, iBlocky);
|
|
5212 |
#else
|
|
5213 |
iRetcode = mng_process_display_dhdr (pData,
|
|
5214 |
((mng_dhdrp)pChunk)->iObjectid,
|
|
5215 |
((mng_dhdrp)pChunk)->iImagetype,
|
|
5216 |
((mng_dhdrp)pChunk)->iDeltatype,
|
|
5217 |
((mng_dhdrp)pChunk)->iBlockwidth,
|
|
5218 |
((mng_dhdrp)pChunk)->iBlockheight,
|
|
5219 |
((mng_dhdrp)pChunk)->iBlockx,
|
|
5220 |
((mng_dhdrp)pChunk)->iBlocky);
|
|
5221 |
#endif
|
|
5222 |
#else
|
|
5223 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5224 |
pData->iDHDRobjectid = iObjectid;
|
|
5225 |
pData->iDHDRimagetype = iImagetype;
|
|
5226 |
pData->iDHDRdeltatype = iDeltatype;
|
|
5227 |
pData->iDHDRblockwidth = iBlockwidth;
|
|
5228 |
pData->iDHDRblockheight = iBlockheight;
|
|
5229 |
pData->iDHDRblockx = iBlockx;
|
|
5230 |
pData->iDHDRblocky = iBlocky;
|
|
5231 |
#else
|
|
5232 |
pData->iDHDRobjectid = ((mng_dhdrp)pChunk)->iObjectid;
|
|
5233 |
pData->iDHDRimagetype = ((mng_dhdrp)pChunk)->iImagetype;
|
|
5234 |
pData->iDHDRdeltatype = ((mng_dhdrp)pChunk)->iDeltatype;
|
|
5235 |
pData->iDHDRblockwidth = ((mng_dhdrp)pChunk)->iBlockwidth;
|
|
5236 |
pData->iDHDRblockheight = ((mng_dhdrp)pChunk)->iBlockheight;
|
|
5237 |
pData->iDHDRblockx = ((mng_dhdrp)pChunk)->iBlockx;
|
|
5238 |
pData->iDHDRblocky = ((mng_dhdrp)pChunk)->iBlocky;
|
|
5239 |
#endif
|
|
5240 |
|
|
5241 |
iRetcode = mng_process_display_dhdr (pData);
|
|
5242 |
#endif
|
|
5243 |
|
|
5244 |
#ifdef MNG_SUPPORT_TRACE
|
|
5245 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_DHDR, MNG_LC_END);
|
|
5246 |
#endif
|
|
5247 |
|
|
5248 |
return iRetcode;
|
|
5249 |
}
|
|
5250 |
|
|
5251 |
/* ************************************************************************** */
|
|
5252 |
|
|
5253 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5254 |
mng_retcode mng_free_ani_dhdr (mng_datap pData,
|
|
5255 |
mng_objectp pObject)
|
|
5256 |
{
|
|
5257 |
#ifdef MNG_SUPPORT_TRACE
|
|
5258 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_DHDR, MNG_LC_START);
|
|
5259 |
#endif
|
|
5260 |
|
|
5261 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_dhdr));
|
|
5262 |
|
|
5263 |
#ifdef MNG_SUPPORT_TRACE
|
|
5264 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_DHDR, MNG_LC_END);
|
|
5265 |
#endif
|
|
5266 |
|
|
5267 |
return MNG_NOERROR;
|
|
5268 |
}
|
|
5269 |
#endif
|
|
5270 |
|
|
5271 |
/* ************************************************************************** */
|
|
5272 |
|
|
5273 |
mng_retcode mng_process_ani_dhdr (mng_datap pData,
|
|
5274 |
mng_objectp pObject)
|
|
5275 |
{
|
|
5276 |
mng_ani_dhdrp pDHDR = (mng_ani_dhdrp)pObject;
|
|
5277 |
mng_retcode iRetcode;
|
|
5278 |
|
|
5279 |
#ifdef MNG_SUPPORT_TRACE
|
|
5280 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_START);
|
|
5281 |
#endif
|
|
5282 |
|
|
5283 |
pData->bHasDHDR = MNG_TRUE; /* let everyone know we're inside a DHDR */
|
|
5284 |
|
|
5285 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5286 |
iRetcode = mng_process_display_dhdr (pData, pDHDR->iObjectid,
|
|
5287 |
pDHDR->iImagetype, pDHDR->iDeltatype,
|
|
5288 |
pDHDR->iBlockwidth, pDHDR->iBlockheight,
|
|
5289 |
pDHDR->iBlockx, pDHDR->iBlocky);
|
|
5290 |
#else
|
|
5291 |
pData->iDHDRobjectid = pDHDR->iObjectid;
|
|
5292 |
pData->iDHDRimagetype = pDHDR->iImagetype;
|
|
5293 |
pData->iDHDRdeltatype = pDHDR->iDeltatype;
|
|
5294 |
pData->iDHDRblockwidth = pDHDR->iBlockwidth;
|
|
5295 |
pData->iDHDRblockheight = pDHDR->iBlockheight;
|
|
5296 |
pData->iDHDRblockx = pDHDR->iBlockx;
|
|
5297 |
pData->iDHDRblocky = pDHDR->iBlocky;
|
|
5298 |
|
|
5299 |
iRetcode = mng_process_display_dhdr (pData);
|
|
5300 |
#endif
|
|
5301 |
|
|
5302 |
#ifdef MNG_SUPPORT_TRACE
|
|
5303 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_END);
|
|
5304 |
#endif
|
|
5305 |
|
|
5306 |
return iRetcode;
|
|
5307 |
}
|
|
5308 |
#endif
|
|
5309 |
|
|
5310 |
/* ************************************************************************** */
|
|
5311 |
|
|
5312 |
#ifndef MNG_NO_DELTA_PNG
|
|
5313 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5314 |
mng_retcode mng_create_ani_prom (mng_datap pData,
|
|
5315 |
mng_uint8 iBitdepth,
|
|
5316 |
mng_uint8 iColortype,
|
|
5317 |
mng_uint8 iFilltype)
|
|
5318 |
#else
|
|
5319 |
mng_retcode mng_create_ani_prom (mng_datap pData,
|
|
5320 |
mng_chunkp pChunk)
|
|
5321 |
#endif
|
|
5322 |
{
|
|
5323 |
mng_ani_promp pPROM=NULL;
|
|
5324 |
mng_retcode iRetcode;
|
|
5325 |
|
|
5326 |
#ifdef MNG_SUPPORT_TRACE
|
|
5327 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PROM, MNG_LC_START);
|
|
5328 |
#endif
|
|
5329 |
|
|
5330 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5331 |
{
|
|
5332 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5333 |
mng_ptr pTemp;
|
|
5334 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_prom),
|
|
5335 |
mng_free_obj_general,
|
|
5336 |
mng_process_ani_prom,
|
|
5337 |
&pTemp);
|
|
5338 |
if (iRetcode)
|
|
5339 |
return iRetcode;
|
|
5340 |
pPROM = (mng_ani_promp)pTemp;
|
|
5341 |
#else
|
|
5342 |
MNG_ALLOC (pData, pPROM, sizeof (mng_ani_prom));
|
|
5343 |
|
|
5344 |
pPROM->sHeader.fCleanup = mng_free_ani_prom;
|
|
5345 |
pPROM->sHeader.fProcess = mng_process_ani_prom;
|
|
5346 |
#endif
|
|
5347 |
|
|
5348 |
mng_add_ani_object (pData, (mng_object_headerp)pPROM);
|
|
5349 |
|
|
5350 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5351 |
pPROM->iBitdepth = iBitdepth;
|
|
5352 |
pPROM->iColortype = iColortype;
|
|
5353 |
pPROM->iFilltype = iFilltype;
|
|
5354 |
#else
|
|
5355 |
pPROM->iBitdepth = ((mng_promp)pChunk)->iSampledepth;
|
|
5356 |
pPROM->iColortype = ((mng_promp)pChunk)->iColortype;
|
|
5357 |
pPROM->iFilltype = ((mng_promp)pChunk)->iFilltype;
|
|
5358 |
#endif
|
|
5359 |
}
|
|
5360 |
|
|
5361 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5362 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5363 |
iRetcode = mng_process_display_prom (pData, iBitdepth,
|
|
5364 |
iColortype, iFilltype);
|
|
5365 |
#else
|
|
5366 |
iRetcode = mng_process_display_prom (pData,
|
|
5367 |
((mng_promp)pChunk)->iSampledepth,
|
|
5368 |
((mng_promp)pChunk)->iColortype,
|
|
5369 |
((mng_promp)pChunk)->iFilltype);
|
|
5370 |
#endif
|
|
5371 |
#else
|
|
5372 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5373 |
pData->iPROMbitdepth = iBitdepth;
|
|
5374 |
pData->iPROMcolortype = iColortype;
|
|
5375 |
pData->iPROMfilltype = iFilltype;
|
|
5376 |
#else
|
|
5377 |
pData->iPROMbitdepth = ((mng_promp)pChunk)->iSampledepth;
|
|
5378 |
pData->iPROMcolortype = ((mng_promp)pChunk)->iColortype;
|
|
5379 |
pData->iPROMfilltype = ((mng_promp)pChunk)->iFilltype;
|
|
5380 |
#endif
|
|
5381 |
|
|
5382 |
iRetcode = mng_process_display_prom (pData);
|
|
5383 |
#endif
|
|
5384 |
|
|
5385 |
#ifdef MNG_SUPPORT_TRACE
|
|
5386 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PROM, MNG_LC_END);
|
|
5387 |
#endif
|
|
5388 |
|
|
5389 |
return iRetcode;
|
|
5390 |
}
|
|
5391 |
|
|
5392 |
/* ************************************************************************** */
|
|
5393 |
|
|
5394 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5395 |
mng_retcode mng_free_ani_prom (mng_datap pData,
|
|
5396 |
mng_objectp pObject)
|
|
5397 |
{
|
|
5398 |
#ifdef MNG_SUPPORT_TRACE
|
|
5399 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PROM, MNG_LC_START);
|
|
5400 |
#endif
|
|
5401 |
|
|
5402 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_prom));
|
|
5403 |
|
|
5404 |
#ifdef MNG_SUPPORT_TRACE
|
|
5405 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PROM, MNG_LC_END);
|
|
5406 |
#endif
|
|
5407 |
|
|
5408 |
return MNG_NOERROR;
|
|
5409 |
}
|
|
5410 |
#endif
|
|
5411 |
|
|
5412 |
/* ************************************************************************** */
|
|
5413 |
|
|
5414 |
mng_retcode mng_process_ani_prom (mng_datap pData,
|
|
5415 |
mng_objectp pObject)
|
|
5416 |
{
|
|
5417 |
mng_ani_promp pPROM = (mng_ani_promp)pObject;
|
|
5418 |
mng_retcode iRetcode;
|
|
5419 |
|
|
5420 |
#ifdef MNG_SUPPORT_TRACE
|
|
5421 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PROM, MNG_LC_START);
|
|
5422 |
#endif
|
|
5423 |
|
|
5424 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5425 |
iRetcode = mng_process_display_prom (pData, pPROM->iBitdepth,
|
|
5426 |
pPROM->iColortype, pPROM->iFilltype);
|
|
5427 |
#else
|
|
5428 |
pData->iPROMbitdepth = pPROM->iBitdepth;
|
|
5429 |
pData->iPROMcolortype = pPROM->iColortype;
|
|
5430 |
pData->iPROMfilltype = pPROM->iFilltype;
|
|
5431 |
|
|
5432 |
iRetcode = mng_process_display_prom (pData);
|
|
5433 |
#endif
|
|
5434 |
|
|
5435 |
#ifdef MNG_SUPPORT_TRACE
|
|
5436 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PROM, MNG_LC_END);
|
|
5437 |
#endif
|
|
5438 |
|
|
5439 |
return iRetcode;
|
|
5440 |
}
|
|
5441 |
#endif
|
|
5442 |
|
|
5443 |
/* ************************************************************************** */
|
|
5444 |
|
|
5445 |
#ifndef MNG_NO_DELTA_PNG
|
|
5446 |
mng_retcode mng_create_ani_ipng (mng_datap pData)
|
|
5447 |
{
|
|
5448 |
mng_ani_ipngp pIPNG;
|
|
5449 |
|
|
5450 |
#ifdef MNG_SUPPORT_TRACE
|
|
5451 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IPNG, MNG_LC_START);
|
|
5452 |
#endif
|
|
5453 |
|
|
5454 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5455 |
{
|
|
5456 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5457 |
mng_ptr pTemp;
|
|
5458 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_ipng),
|
|
5459 |
mng_free_obj_general,
|
|
5460 |
mng_process_ani_ipng,
|
|
5461 |
&pTemp);
|
|
5462 |
if (iRetcode)
|
|
5463 |
return iRetcode;
|
|
5464 |
pIPNG = (mng_ani_ipngp)pTemp;
|
|
5465 |
#else
|
|
5466 |
MNG_ALLOC (pData, pIPNG, sizeof (mng_ani_ipng));
|
|
5467 |
|
|
5468 |
pIPNG->sHeader.fCleanup = mng_free_ani_ipng;
|
|
5469 |
pIPNG->sHeader.fProcess = mng_process_ani_ipng;
|
|
5470 |
#endif
|
|
5471 |
|
|
5472 |
mng_add_ani_object (pData, (mng_object_headerp)pIPNG);
|
|
5473 |
}
|
|
5474 |
|
|
5475 |
#ifdef MNG_SUPPORT_TRACE
|
|
5476 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IPNG, MNG_LC_END);
|
|
5477 |
#endif
|
|
5478 |
|
|
5479 |
return MNG_NOERROR;
|
|
5480 |
}
|
|
5481 |
|
|
5482 |
/* ************************************************************************** */
|
|
5483 |
|
|
5484 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5485 |
mng_retcode mng_free_ani_ipng (mng_datap pData,
|
|
5486 |
mng_objectp pObject)
|
|
5487 |
{
|
|
5488 |
#ifdef MNG_SUPPORT_TRACE
|
|
5489 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_IPNG, MNG_LC_START);
|
|
5490 |
#endif
|
|
5491 |
|
|
5492 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_ipng));
|
|
5493 |
|
|
5494 |
#ifdef MNG_SUPPORT_TRACE
|
|
5495 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_IPNG, MNG_LC_END);
|
|
5496 |
#endif
|
|
5497 |
|
|
5498 |
return MNG_NOERROR;
|
|
5499 |
}
|
|
5500 |
#endif
|
|
5501 |
|
|
5502 |
/* ************************************************************************** */
|
|
5503 |
|
|
5504 |
mng_retcode mng_process_ani_ipng (mng_datap pData,
|
|
5505 |
mng_objectp pObject)
|
|
5506 |
{
|
|
5507 |
mng_retcode iRetcode;
|
|
5508 |
|
|
5509 |
#ifdef MNG_SUPPORT_TRACE
|
|
5510 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IPNG, MNG_LC_START);
|
|
5511 |
#endif
|
|
5512 |
|
|
5513 |
iRetcode = mng_process_display_ipng (pData);
|
|
5514 |
|
|
5515 |
if (iRetcode) /* on error bail out */
|
|
5516 |
return iRetcode;
|
|
5517 |
|
|
5518 |
#ifdef MNG_SUPPORT_TRACE
|
|
5519 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IPNG, MNG_LC_END);
|
|
5520 |
#endif
|
|
5521 |
|
|
5522 |
return MNG_NOERROR;
|
|
5523 |
}
|
|
5524 |
#endif
|
|
5525 |
|
|
5526 |
/* ************************************************************************** */
|
|
5527 |
|
|
5528 |
#ifndef MNG_NO_DELTA_PNG
|
|
5529 |
#ifdef MNG_INCLUDE_JNG
|
|
5530 |
mng_retcode mng_create_ani_ijng (mng_datap pData)
|
|
5531 |
{
|
|
5532 |
mng_ani_ijngp pIJNG;
|
|
5533 |
|
|
5534 |
#ifdef MNG_SUPPORT_TRACE
|
|
5535 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IJNG, MNG_LC_START);
|
|
5536 |
#endif
|
|
5537 |
|
|
5538 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5539 |
{
|
|
5540 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5541 |
mng_ptr pTemp;
|
|
5542 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_ijng),
|
|
5543 |
mng_free_obj_general,
|
|
5544 |
mng_process_ani_ijng,
|
|
5545 |
&pTemp);
|
|
5546 |
if (iRetcode)
|
|
5547 |
return iRetcode;
|
|
5548 |
pIJNG = (mng_ani_ijngp)pTemp;
|
|
5549 |
#else
|
|
5550 |
MNG_ALLOC (pData, pIJNG, sizeof (mng_ani_ijng));
|
|
5551 |
|
|
5552 |
pIJNG->sHeader.fCleanup = mng_free_ani_ijng;
|
|
5553 |
pIJNG->sHeader.fProcess = mng_process_ani_ijng;
|
|
5554 |
#endif
|
|
5555 |
|
|
5556 |
mng_add_ani_object (pData, (mng_object_headerp)pIJNG);
|
|
5557 |
}
|
|
5558 |
|
|
5559 |
#ifdef MNG_SUPPORT_TRACE
|
|
5560 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_IJNG, MNG_LC_END);
|
|
5561 |
#endif
|
|
5562 |
|
|
5563 |
return MNG_NOERROR;
|
|
5564 |
}
|
|
5565 |
|
|
5566 |
/* ************************************************************************** */
|
|
5567 |
|
|
5568 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5569 |
mng_retcode mng_free_ani_ijng (mng_datap pData,
|
|
5570 |
mng_objectp pObject)
|
|
5571 |
{
|
|
5572 |
#ifdef MNG_SUPPORT_TRACE
|
|
5573 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_IJNG, MNG_LC_START);
|
|
5574 |
#endif
|
|
5575 |
|
|
5576 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_ijng));
|
|
5577 |
|
|
5578 |
#ifdef MNG_SUPPORT_TRACE
|
|
5579 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_IJNG, MNG_LC_END);
|
|
5580 |
#endif
|
|
5581 |
|
|
5582 |
return MNG_NOERROR;
|
|
5583 |
}
|
|
5584 |
#endif
|
|
5585 |
|
|
5586 |
/* ************************************************************************** */
|
|
5587 |
|
|
5588 |
mng_retcode mng_process_ani_ijng (mng_datap pData,
|
|
5589 |
mng_objectp pObject)
|
|
5590 |
{
|
|
5591 |
mng_retcode iRetcode;
|
|
5592 |
|
|
5593 |
#ifdef MNG_SUPPORT_TRACE
|
|
5594 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IJNG, MNG_LC_START);
|
|
5595 |
#endif
|
|
5596 |
|
|
5597 |
iRetcode = mng_process_display_ijng (pData);
|
|
5598 |
|
|
5599 |
if (iRetcode) /* on error bail out */
|
|
5600 |
return iRetcode;
|
|
5601 |
|
|
5602 |
#ifdef MNG_SUPPORT_TRACE
|
|
5603 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IJNG, MNG_LC_END);
|
|
5604 |
#endif
|
|
5605 |
|
|
5606 |
return MNG_NOERROR;
|
|
5607 |
}
|
|
5608 |
#endif
|
|
5609 |
#endif
|
|
5610 |
|
|
5611 |
/* ************************************************************************** */
|
|
5612 |
|
|
5613 |
#ifndef MNG_NO_DELTA_PNG
|
|
5614 |
mng_retcode mng_create_ani_pplt (mng_datap pData,
|
|
5615 |
mng_uint8 iType,
|
|
5616 |
mng_uint32 iCount,
|
|
5617 |
mng_palette8ep paIndexentries,
|
|
5618 |
mng_uint8p paAlphaentries,
|
|
5619 |
mng_uint8p paUsedentries)
|
|
5620 |
{
|
|
5621 |
mng_ani_ppltp pPPLT;
|
|
5622 |
mng_retcode iRetcode;
|
|
5623 |
|
|
5624 |
#ifdef MNG_SUPPORT_TRACE
|
|
5625 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_START);
|
|
5626 |
#endif
|
|
5627 |
|
|
5628 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5629 |
{
|
|
5630 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5631 |
mng_ptr pTemp;
|
|
5632 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_pplt),
|
|
5633 |
mng_free_obj_general,
|
|
5634 |
mng_process_ani_pplt,
|
|
5635 |
&pTemp);
|
|
5636 |
if (iRetcode)
|
|
5637 |
return iRetcode;
|
|
5638 |
pPPLT = (mng_ani_ppltp)pTemp;
|
|
5639 |
#else
|
|
5640 |
MNG_ALLOC (pData, pPPLT, sizeof (mng_ani_pplt));
|
|
5641 |
|
|
5642 |
pPPLT->sHeader.fCleanup = mng_free_ani_pplt;
|
|
5643 |
pPPLT->sHeader.fProcess = mng_process_ani_pplt;
|
|
5644 |
#endif
|
|
5645 |
|
|
5646 |
pPPLT->iType = iType;
|
|
5647 |
pPPLT->iCount = iCount;
|
|
5648 |
|
|
5649 |
MNG_COPY (pPPLT->aIndexentries, paIndexentries, sizeof (pPPLT->aIndexentries));
|
|
5650 |
MNG_COPY (pPPLT->aAlphaentries, paAlphaentries, sizeof (pPPLT->aAlphaentries));
|
|
5651 |
MNG_COPY (pPPLT->aUsedentries, paUsedentries, sizeof (pPPLT->aUsedentries ));
|
|
5652 |
|
|
5653 |
mng_add_ani_object (pData, (mng_object_headerp)pPPLT);
|
|
5654 |
}
|
|
5655 |
|
|
5656 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5657 |
iRetcode = mng_process_display_pplt (pData, iType, iCount,
|
|
5658 |
paIndexentries, paAlphaentries, paUsedentries);
|
|
5659 |
#else
|
|
5660 |
pData->iPPLTtype = iType;
|
|
5661 |
pData->iPPLTcount = iCount;
|
|
5662 |
pData->paPPLTindexentries = paIndexentries;
|
|
5663 |
pData->paPPLTalphaentries = paAlphaentries;
|
|
5664 |
pData->paPPLTusedentries = paUsedentries;
|
|
5665 |
|
|
5666 |
iRetcode = mng_process_display_pplt (pData);
|
|
5667 |
#endif
|
|
5668 |
|
|
5669 |
#ifdef MNG_SUPPORT_TRACE
|
|
5670 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_END);
|
|
5671 |
#endif
|
|
5672 |
|
|
5673 |
return iRetcode;
|
|
5674 |
}
|
|
5675 |
|
|
5676 |
/* ************************************************************************** */
|
|
5677 |
|
|
5678 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5679 |
mng_retcode mng_free_ani_pplt (mng_datap pData,
|
|
5680 |
mng_objectp pObject)
|
|
5681 |
{
|
|
5682 |
#ifdef MNG_SUPPORT_TRACE
|
|
5683 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_START);
|
|
5684 |
#endif
|
|
5685 |
|
|
5686 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_pplt));
|
|
5687 |
|
|
5688 |
#ifdef MNG_SUPPORT_TRACE
|
|
5689 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_END);
|
|
5690 |
#endif
|
|
5691 |
|
|
5692 |
return MNG_NOERROR;
|
|
5693 |
}
|
|
5694 |
#endif
|
|
5695 |
|
|
5696 |
/* ************************************************************************** */
|
|
5697 |
|
|
5698 |
mng_retcode mng_process_ani_pplt (mng_datap pData,
|
|
5699 |
mng_objectp pObject)
|
|
5700 |
{
|
|
5701 |
mng_ani_ppltp pPPLT = (mng_ani_ppltp)pObject;
|
|
5702 |
mng_retcode iRetcode;
|
|
5703 |
|
|
5704 |
#ifdef MNG_SUPPORT_TRACE
|
|
5705 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_START);
|
|
5706 |
#endif
|
|
5707 |
|
|
5708 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5709 |
iRetcode = mng_process_display_pplt (pData, pPPLT->iType, pPPLT->iCount,
|
|
5710 |
pPPLT->aIndexentries, pPPLT->aAlphaentries,
|
|
5711 |
pPPLT->aUsedentries);
|
|
5712 |
#else
|
|
5713 |
pData->iPPLTtype = pPPLT->iType;
|
|
5714 |
pData->iPPLTcount = pPPLT->iCount;
|
|
5715 |
pData->paPPLTindexentries = &pPPLT->aIndexentries;
|
|
5716 |
pData->paPPLTalphaentries = &pPPLT->aAlphaentries;
|
|
5717 |
pData->paPPLTusedentries = &pPPLT->aUsedentries;
|
|
5718 |
|
|
5719 |
iRetcode = mng_process_display_pplt (pData);
|
|
5720 |
#endif
|
|
5721 |
|
|
5722 |
#ifdef MNG_SUPPORT_TRACE
|
|
5723 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_END);
|
|
5724 |
#endif
|
|
5725 |
|
|
5726 |
return iRetcode;
|
|
5727 |
}
|
|
5728 |
#endif
|
|
5729 |
|
|
5730 |
/* ************************************************************************** */
|
|
5731 |
|
|
5732 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
5733 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5734 |
mng_retcode mng_create_ani_magn (mng_datap pData,
|
|
5735 |
mng_uint16 iFirstid,
|
|
5736 |
mng_uint16 iLastid,
|
|
5737 |
mng_uint8 iMethodX,
|
|
5738 |
mng_uint16 iMX,
|
|
5739 |
mng_uint16 iMY,
|
|
5740 |
mng_uint16 iML,
|
|
5741 |
mng_uint16 iMR,
|
|
5742 |
mng_uint16 iMT,
|
|
5743 |
mng_uint16 iMB,
|
|
5744 |
mng_uint8 iMethodY)
|
|
5745 |
#else
|
|
5746 |
mng_retcode mng_create_ani_magn (mng_datap pData,
|
|
5747 |
mng_chunkp pChunk)
|
|
5748 |
#endif
|
|
5749 |
{
|
|
5750 |
mng_ani_magnp pMAGN=NULL;
|
|
5751 |
mng_retcode iRetcode;
|
|
5752 |
|
|
5753 |
#ifdef MNG_SUPPORT_TRACE
|
|
5754 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_START);
|
|
5755 |
#endif
|
|
5756 |
|
|
5757 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5758 |
{
|
|
5759 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5760 |
mng_ptr pTemp;
|
|
5761 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_magn),
|
|
5762 |
mng_free_obj_general,
|
|
5763 |
mng_process_ani_magn,
|
|
5764 |
&pTemp);
|
|
5765 |
if (iRetcode)
|
|
5766 |
return iRetcode;
|
|
5767 |
pMAGN = (mng_ani_magnp)pTemp;
|
|
5768 |
#else
|
|
5769 |
MNG_ALLOC (pData, pMAGN, sizeof (mng_ani_magn));
|
|
5770 |
|
|
5771 |
pMAGN->sHeader.fCleanup = mng_free_ani_magn;
|
|
5772 |
pMAGN->sHeader.fProcess = mng_process_ani_magn;
|
|
5773 |
#endif
|
|
5774 |
|
|
5775 |
mng_add_ani_object (pData, (mng_object_headerp)pMAGN);
|
|
5776 |
|
|
5777 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5778 |
pMAGN->iFirstid = iFirstid;
|
|
5779 |
pMAGN->iLastid = iLastid;
|
|
5780 |
pMAGN->iMethodX = iMethodX;
|
|
5781 |
pMAGN->iMX = iMX;
|
|
5782 |
pMAGN->iMY = iMY;
|
|
5783 |
pMAGN->iML = iML;
|
|
5784 |
pMAGN->iMR = iMR;
|
|
5785 |
pMAGN->iMT = iMT;
|
|
5786 |
pMAGN->iMB = iMB;
|
|
5787 |
pMAGN->iMethodY = iMethodY;
|
|
5788 |
#else
|
|
5789 |
pMAGN->iFirstid = ((mng_magnp)pChunk)->iFirstid;
|
|
5790 |
pMAGN->iLastid = ((mng_magnp)pChunk)->iLastid;
|
|
5791 |
pMAGN->iMethodX = ((mng_magnp)pChunk)->iMethodX;
|
|
5792 |
pMAGN->iMX = ((mng_magnp)pChunk)->iMX;
|
|
5793 |
pMAGN->iMY = ((mng_magnp)pChunk)->iMY;
|
|
5794 |
pMAGN->iML = ((mng_magnp)pChunk)->iML;
|
|
5795 |
pMAGN->iMR = ((mng_magnp)pChunk)->iMR;
|
|
5796 |
pMAGN->iMT = ((mng_magnp)pChunk)->iMT;
|
|
5797 |
pMAGN->iMB = ((mng_magnp)pChunk)->iMB;
|
|
5798 |
pMAGN->iMethodY = ((mng_magnp)pChunk)->iMethodY;
|
|
5799 |
#endif
|
|
5800 |
}
|
|
5801 |
|
|
5802 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5803 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5804 |
iRetcode = mng_process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid,
|
|
5805 |
pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY,
|
|
5806 |
pMAGN->iML, pMAGN->iMR, pMAGN->iMT,
|
|
5807 |
pMAGN->iMB, pMAGN->iMethodY);
|
|
5808 |
#else
|
|
5809 |
iRetcode = mng_process_display_magn (pData,
|
|
5810 |
((mng_magnp)pChunk)->iFirstid,
|
|
5811 |
((mng_magnp)pChunk)->iLastid,
|
|
5812 |
((mng_magnp)pChunk)->iMethodX,
|
|
5813 |
((mng_magnp)pChunk)->iMX,
|
|
5814 |
((mng_magnp)pChunk)->iMY,
|
|
5815 |
((mng_magnp)pChunk)->iML,
|
|
5816 |
((mng_magnp)pChunk)->iMR,
|
|
5817 |
((mng_magnp)pChunk)->iMT,
|
|
5818 |
((mng_magnp)pChunk)->iMB,
|
|
5819 |
((mng_magnp)pChunk)->iMethodY);
|
|
5820 |
#endif
|
|
5821 |
#else
|
|
5822 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5823 |
pData->iMAGNfirstid = iFirstid;
|
|
5824 |
pData->iMAGNlastid = iLastid;
|
|
5825 |
pData->iMAGNmethodX = iMethodX;
|
|
5826 |
pData->iMAGNmX = iMX;
|
|
5827 |
pData->iMAGNmY = iMY;
|
|
5828 |
pData->iMAGNmL = iML;
|
|
5829 |
pData->iMAGNmR = iMR;
|
|
5830 |
pData->iMAGNmT = iMT;
|
|
5831 |
pData->iMAGNmB = iMB;
|
|
5832 |
pData->iMAGNmethodY = iMethodY;
|
|
5833 |
#else
|
|
5834 |
pData->iMAGNfirstid = ((mng_magnp)pChunk)->iFirstid;
|
|
5835 |
pData->iMAGNlastid = ((mng_magnp)pChunk)->iLastid;
|
|
5836 |
pData->iMAGNmethodX = ((mng_magnp)pChunk)->iMethodX;
|
|
5837 |
pData->iMAGNmX = ((mng_magnp)pChunk)->iMX;
|
|
5838 |
pData->iMAGNmY = ((mng_magnp)pChunk)->iMY;
|
|
5839 |
pData->iMAGNmL = ((mng_magnp)pChunk)->iML;
|
|
5840 |
pData->iMAGNmR = ((mng_magnp)pChunk)->iMR;
|
|
5841 |
pData->iMAGNmT = ((mng_magnp)pChunk)->iMT;
|
|
5842 |
pData->iMAGNmB = ((mng_magnp)pChunk)->iMB;
|
|
5843 |
pData->iMAGNmethodY = ((mng_magnp)pChunk)->iMethodY;
|
|
5844 |
#endif
|
|
5845 |
|
|
5846 |
iRetcode = mng_process_display_magn (pData);
|
|
5847 |
#endif
|
|
5848 |
|
|
5849 |
#ifdef MNG_SUPPORT_TRACE
|
|
5850 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_END);
|
|
5851 |
#endif
|
|
5852 |
|
|
5853 |
return iRetcode;
|
|
5854 |
}
|
|
5855 |
|
|
5856 |
/* ************************************************************************** */
|
|
5857 |
|
|
5858 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
5859 |
mng_retcode mng_free_ani_magn (mng_datap pData,
|
|
5860 |
mng_objectp pObject)
|
|
5861 |
{
|
|
5862 |
#ifdef MNG_SUPPORT_TRACE
|
|
5863 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_START);
|
|
5864 |
#endif
|
|
5865 |
|
|
5866 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_magn));
|
|
5867 |
|
|
5868 |
#ifdef MNG_SUPPORT_TRACE
|
|
5869 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_END);
|
|
5870 |
#endif
|
|
5871 |
|
|
5872 |
return MNG_NOERROR;
|
|
5873 |
}
|
|
5874 |
#endif
|
|
5875 |
|
|
5876 |
/* ************************************************************************** */
|
|
5877 |
|
|
5878 |
mng_retcode mng_process_ani_magn (mng_datap pData,
|
|
5879 |
mng_objectp pObject)
|
|
5880 |
{
|
|
5881 |
mng_ani_magnp pMAGN = (mng_ani_magnp)pObject;
|
|
5882 |
mng_retcode iRetcode;
|
|
5883 |
|
|
5884 |
#ifdef MNG_SUPPORT_TRACE
|
|
5885 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_START);
|
|
5886 |
#endif
|
|
5887 |
|
|
5888 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5889 |
iRetcode = mng_process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid,
|
|
5890 |
pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY,
|
|
5891 |
pMAGN->iML, pMAGN->iMR, pMAGN->iMT,
|
|
5892 |
pMAGN->iMB, pMAGN->iMethodY);
|
|
5893 |
#else
|
|
5894 |
pData->iMAGNfirstid = pMAGN->iFirstid;
|
|
5895 |
pData->iMAGNlastid = pMAGN->iLastid;
|
|
5896 |
pData->iMAGNmethodX = pMAGN->iMethodX;
|
|
5897 |
pData->iMAGNmX = pMAGN->iMX;
|
|
5898 |
pData->iMAGNmY = pMAGN->iMY;
|
|
5899 |
pData->iMAGNmL = pMAGN->iML;
|
|
5900 |
pData->iMAGNmR = pMAGN->iMR;
|
|
5901 |
pData->iMAGNmT = pMAGN->iMT;
|
|
5902 |
pData->iMAGNmB = pMAGN->iMB;
|
|
5903 |
pData->iMAGNmethodY = pMAGN->iMethodY;
|
|
5904 |
|
|
5905 |
iRetcode = mng_process_display_magn (pData);
|
|
5906 |
#endif
|
|
5907 |
|
|
5908 |
#ifdef MNG_SUPPORT_TRACE
|
|
5909 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_END);
|
|
5910 |
#endif
|
|
5911 |
|
|
5912 |
return iRetcode;
|
|
5913 |
}
|
|
5914 |
#endif
|
|
5915 |
|
|
5916 |
/* ************************************************************************** */
|
|
5917 |
|
|
5918 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
5919 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5920 |
mng_retcode mng_create_ani_past (mng_datap pData,
|
|
5921 |
mng_uint16 iTargetid,
|
|
5922 |
mng_uint8 iTargettype,
|
|
5923 |
mng_int32 iTargetx,
|
|
5924 |
mng_int32 iTargety,
|
|
5925 |
mng_uint32 iCount,
|
|
5926 |
mng_ptr pSources)
|
|
5927 |
#else
|
|
5928 |
mng_retcode mng_create_ani_past (mng_datap pData,
|
|
5929 |
mng_chunkp pChunk)
|
|
5930 |
#endif
|
|
5931 |
{
|
|
5932 |
mng_ani_pastp pPAST;
|
|
5933 |
mng_retcode iRetcode;
|
|
5934 |
|
|
5935 |
#ifdef MNG_SUPPORT_TRACE
|
|
5936 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PAST, MNG_LC_START);
|
|
5937 |
#endif
|
|
5938 |
|
|
5939 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
5940 |
{
|
|
5941 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
5942 |
mng_ptr pTemp;
|
|
5943 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_past),
|
|
5944 |
mng_free_ani_past,
|
|
5945 |
mng_process_ani_past,
|
|
5946 |
&pTemp);
|
|
5947 |
if (iRetcode)
|
|
5948 |
return iRetcode;
|
|
5949 |
pPAST = (mng_ani_pastp)pTemp;
|
|
5950 |
#else
|
|
5951 |
MNG_ALLOC (pData, pPAST, sizeof (mng_ani_past));
|
|
5952 |
|
|
5953 |
pPAST->sHeader.fCleanup = mng_free_ani_past;
|
|
5954 |
pPAST->sHeader.fProcess = mng_process_ani_past;
|
|
5955 |
#endif
|
|
5956 |
|
|
5957 |
mng_add_ani_object (pData, (mng_object_headerp)pPAST);
|
|
5958 |
|
|
5959 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5960 |
pPAST->iTargetid = iTargetid;
|
|
5961 |
pPAST->iTargettype = iTargettype;
|
|
5962 |
pPAST->iTargetx = iTargetx;
|
|
5963 |
pPAST->iTargety = iTargety;
|
|
5964 |
pPAST->iCount = iCount;
|
|
5965 |
|
|
5966 |
if (iCount)
|
|
5967 |
{
|
|
5968 |
MNG_ALLOC (pData, pPAST->pSources, (iCount * sizeof (mng_past_source)));
|
|
5969 |
MNG_COPY (pPAST->pSources, pSources, (iCount * sizeof (mng_past_source)));
|
|
5970 |
}
|
|
5971 |
#else
|
|
5972 |
pPAST->iTargetid = ((mng_pastp)pChunk)->iDestid;
|
|
5973 |
pPAST->iTargettype = ((mng_pastp)pChunk)->iTargettype;
|
|
5974 |
pPAST->iTargetx = ((mng_pastp)pChunk)->iTargetx;
|
|
5975 |
pPAST->iTargety = ((mng_pastp)pChunk)->iTargety;
|
|
5976 |
pPAST->iCount = ((mng_pastp)pChunk)->iCount;
|
|
5977 |
|
|
5978 |
if (pPAST->iCount)
|
|
5979 |
{
|
|
5980 |
mng_size_t iSize = (mng_size_t)(pPAST->iCount * sizeof (mng_past_source));
|
|
5981 |
MNG_ALLOC (pData, pPAST->pSources, iSize);
|
|
5982 |
MNG_COPY (pPAST->pSources, ((mng_pastp)pChunk)->pSources, iSize);
|
|
5983 |
}
|
|
5984 |
#endif
|
|
5985 |
}
|
|
5986 |
|
|
5987 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
5988 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
5989 |
iRetcode = mng_process_display_past (pData, iTargetid, iTargettype,
|
|
5990 |
iTargetx, iTargety,
|
|
5991 |
iCount, pSources);
|
|
5992 |
#else
|
|
5993 |
iRetcode = mng_process_display_past (pData,
|
|
5994 |
((mng_pastp)pChunk)->iDestid,
|
|
5995 |
((mng_pastp)pChunk)->iTargettype,
|
|
5996 |
((mng_pastp)pChunk)->iTargetx,
|
|
5997 |
((mng_pastp)pChunk)->iTargety,
|
|
5998 |
((mng_pastp)pChunk)->iCount,
|
|
5999 |
((mng_pastp)pChunk)->pSources);
|
|
6000 |
#endif
|
|
6001 |
#else
|
|
6002 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6003 |
pData->iPASTtargetid = iTargetid;
|
|
6004 |
pData->iPASTtargettype = iTargettype;
|
|
6005 |
pData->iPASTtargetx = iTargetx;
|
|
6006 |
pData->iPASTtargety = iTargety;
|
|
6007 |
pData->iPASTcount = iCount;
|
|
6008 |
pData->pPASTsources = pSources;
|
|
6009 |
#else
|
|
6010 |
pData->iPASTtargetid = ((mng_pastp)pChunk)->iDestid;
|
|
6011 |
pData->iPASTtargettype = ((mng_pastp)pChunk)->iTargettype;
|
|
6012 |
pData->iPASTtargetx = ((mng_pastp)pChunk)->iTargetx;
|
|
6013 |
pData->iPASTtargety = ((mng_pastp)pChunk)->iTargety;
|
|
6014 |
pData->iPASTcount = ((mng_pastp)pChunk)->iCount;
|
|
6015 |
pData->pPASTsources = ((mng_pastp)pChunk)->pSources;
|
|
6016 |
#endif
|
|
6017 |
|
|
6018 |
iRetcode = mng_process_display_past (pData);
|
|
6019 |
#endif
|
|
6020 |
|
|
6021 |
#ifdef MNG_SUPPORT_TRACE
|
|
6022 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_PAST, MNG_LC_END);
|
|
6023 |
#endif
|
|
6024 |
|
|
6025 |
return iRetcode;
|
|
6026 |
}
|
|
6027 |
#endif
|
|
6028 |
|
|
6029 |
/* ************************************************************************** */
|
|
6030 |
|
|
6031 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
6032 |
mng_retcode mng_free_ani_past (mng_datap pData,
|
|
6033 |
mng_objectp pObject)
|
|
6034 |
{
|
|
6035 |
mng_ani_pastp pPAST = (mng_ani_pastp)pObject;
|
|
6036 |
|
|
6037 |
#ifdef MNG_SUPPORT_TRACE
|
|
6038 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PAST, MNG_LC_START);
|
|
6039 |
#endif
|
|
6040 |
|
|
6041 |
if (pPAST->iCount)
|
|
6042 |
MNG_FREEX (pData, pPAST->pSources, (pPAST->iCount * sizeof (mng_past_source)));
|
|
6043 |
|
|
6044 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6045 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_past));
|
|
6046 |
#endif
|
|
6047 |
|
|
6048 |
#ifdef MNG_SUPPORT_TRACE
|
|
6049 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_PAST, MNG_LC_END);
|
|
6050 |
#endif
|
|
6051 |
|
|
6052 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6053 |
return MNG_NOERROR;
|
|
6054 |
#else
|
|
6055 |
return mng_free_obj_general(pData, pObject);
|
|
6056 |
#endif
|
|
6057 |
}
|
|
6058 |
#endif
|
|
6059 |
|
|
6060 |
/* ************************************************************************** */
|
|
6061 |
|
|
6062 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
6063 |
mng_retcode mng_process_ani_past (mng_datap pData,
|
|
6064 |
mng_objectp pObject)
|
|
6065 |
{
|
|
6066 |
mng_ani_pastp pPAST = (mng_ani_pastp)pObject;
|
|
6067 |
mng_retcode iRetcode;
|
|
6068 |
|
|
6069 |
#ifdef MNG_SUPPORT_TRACE
|
|
6070 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PAST, MNG_LC_START);
|
|
6071 |
#endif
|
|
6072 |
|
|
6073 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
6074 |
iRetcode = mng_process_display_past (pData, pPAST->iTargetid, pPAST->iTargettype,
|
|
6075 |
pPAST->iTargetx, pPAST->iTargety,
|
|
6076 |
pPAST->iCount, pPAST->pSources);
|
|
6077 |
#else
|
|
6078 |
pData->iPASTtargetid = pPAST->iTargetid;
|
|
6079 |
pData->iPASTtargettype = pPAST->iTargettype;
|
|
6080 |
pData->iPASTtargetx = pPAST->iTargetx;
|
|
6081 |
pData->iPASTtargety = pPAST->iTargety;
|
|
6082 |
pData->iPASTcount = pPAST->iCount;
|
|
6083 |
pData->pPASTsources = pPAST->pSources;
|
|
6084 |
|
|
6085 |
iRetcode = mng_process_display_past (pData);
|
|
6086 |
#endif
|
|
6087 |
|
|
6088 |
#ifdef MNG_SUPPORT_TRACE
|
|
6089 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PAST, MNG_LC_END);
|
|
6090 |
#endif
|
|
6091 |
|
|
6092 |
return iRetcode;
|
|
6093 |
}
|
|
6094 |
#endif
|
|
6095 |
|
|
6096 |
/* ************************************************************************** */
|
|
6097 |
|
|
6098 |
#ifndef MNG_SKIPCHUNK_DISC
|
|
6099 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6100 |
mng_retcode mng_create_ani_disc (mng_datap pData,
|
|
6101 |
mng_uint32 iCount,
|
|
6102 |
mng_uint16p pIds)
|
|
6103 |
#else
|
|
6104 |
mng_retcode mng_create_ani_disc (mng_datap pData,
|
|
6105 |
mng_chunkp pChunk)
|
|
6106 |
#endif
|
|
6107 |
{
|
|
6108 |
mng_ani_discp pDISC;
|
|
6109 |
mng_retcode iRetcode;
|
|
6110 |
|
|
6111 |
#ifdef MNG_SUPPORT_TRACE
|
|
6112 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_DISC, MNG_LC_START);
|
|
6113 |
#endif
|
|
6114 |
|
|
6115 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
6116 |
{
|
|
6117 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6118 |
mng_ptr pTemp;
|
|
6119 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_disc),
|
|
6120 |
mng_free_ani_disc,
|
|
6121 |
mng_process_ani_disc,
|
|
6122 |
&pTemp);
|
|
6123 |
if (iRetcode)
|
|
6124 |
return iRetcode;
|
|
6125 |
pDISC = (mng_ani_discp)pTemp;
|
|
6126 |
#else
|
|
6127 |
MNG_ALLOC (pData, pDISC, sizeof (mng_ani_disc));
|
|
6128 |
|
|
6129 |
pDISC->sHeader.fCleanup = mng_free_ani_disc;
|
|
6130 |
pDISC->sHeader.fProcess = mng_process_ani_disc;
|
|
6131 |
#endif
|
|
6132 |
|
|
6133 |
mng_add_ani_object (pData, (mng_object_headerp)pDISC);
|
|
6134 |
|
|
6135 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6136 |
pDISC->iCount = iCount;
|
|
6137 |
|
|
6138 |
if (iCount)
|
|
6139 |
{
|
|
6140 |
MNG_ALLOC (pData, pDISC->pIds, (iCount << 1));
|
|
6141 |
MNG_COPY (pDISC->pIds, pIds, (iCount << 1));
|
|
6142 |
}
|
|
6143 |
#else
|
|
6144 |
pDISC->iCount = ((mng_discp)pChunk)->iCount;
|
|
6145 |
|
|
6146 |
if (pDISC->iCount)
|
|
6147 |
{
|
|
6148 |
mng_size_t iSize = (mng_size_t)(pDISC->iCount << 1);
|
|
6149 |
MNG_ALLOC (pData, pDISC->pIds, iSize);
|
|
6150 |
MNG_COPY (pDISC->pIds, ((mng_discp)pChunk)->pObjectids, iSize);
|
|
6151 |
}
|
|
6152 |
#endif
|
|
6153 |
}
|
|
6154 |
|
|
6155 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
6156 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6157 |
iRetcode = mng_process_display_disc (pData, iCount, pIds);
|
|
6158 |
#else
|
|
6159 |
iRetcode = mng_process_display_disc (pData,
|
|
6160 |
((mng_discp)pChunk)->iCount,
|
|
6161 |
((mng_discp)pChunk)->pObjectids);
|
|
6162 |
#endif
|
|
6163 |
#else
|
|
6164 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6165 |
pData->iDISCcount = iCount;
|
|
6166 |
pData->pDISCids = pIds;
|
|
6167 |
#else
|
|
6168 |
pData->iDISCcount = ((mng_discp)pChunk)->iCount;
|
|
6169 |
pData->pDISCids = ((mng_discp)pChunk)->pObjectids;
|
|
6170 |
#endif
|
|
6171 |
|
|
6172 |
iRetcode = mng_process_display_disc (pData);
|
|
6173 |
#endif
|
|
6174 |
|
|
6175 |
#ifdef MNG_SUPPORT_TRACE
|
|
6176 |
MNG_TRACE (pData, MNG_FN_CREATE_ANI_DISC, MNG_LC_END);
|
|
6177 |
#endif
|
|
6178 |
|
|
6179 |
return MNG_NOERROR;
|
|
6180 |
}
|
|
6181 |
|
|
6182 |
/* ************************************************************************** */
|
|
6183 |
|
|
6184 |
mng_retcode mng_free_ani_disc (mng_datap pData,
|
|
6185 |
mng_objectp pObject)
|
|
6186 |
{
|
|
6187 |
mng_ani_discp pDISC = (mng_ani_discp)pObject;
|
|
6188 |
|
|
6189 |
#ifdef MNG_SUPPORT_TRACE
|
|
6190 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_DISC, MNG_LC_START);
|
|
6191 |
#endif
|
|
6192 |
|
|
6193 |
if (pDISC->iCount)
|
|
6194 |
MNG_FREEX (pData, pDISC->pIds, (pDISC->iCount << 1));
|
|
6195 |
|
|
6196 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6197 |
MNG_FREEX (pData, pObject, sizeof (mng_ani_disc));
|
|
6198 |
#endif
|
|
6199 |
|
|
6200 |
#ifdef MNG_SUPPORT_TRACE
|
|
6201 |
MNG_TRACE (pData, MNG_FN_FREE_ANI_DISC, MNG_LC_END);
|
|
6202 |
#endif
|
|
6203 |
|
|
6204 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6205 |
return MNG_NOERROR;
|
|
6206 |
#else
|
|
6207 |
return mng_free_obj_general(pData, pObject);
|
|
6208 |
#endif
|
|
6209 |
}
|
|
6210 |
|
|
6211 |
/* ************************************************************************** */
|
|
6212 |
|
|
6213 |
mng_retcode mng_process_ani_disc (mng_datap pData,
|
|
6214 |
mng_objectp pObject)
|
|
6215 |
{
|
|
6216 |
mng_ani_discp pDISC = (mng_ani_discp)pObject;
|
|
6217 |
mng_retcode iRetcode;
|
|
6218 |
|
|
6219 |
#ifdef MNG_SUPPORT_TRACE
|
|
6220 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DISC, MNG_LC_START);
|
|
6221 |
#endif
|
|
6222 |
|
|
6223 |
#ifndef MNG_OPTIMIZE_DISPLAYCALLS
|
|
6224 |
iRetcode = mng_process_display_disc (pData, pDISC->iCount, pDISC->pIds);
|
|
6225 |
#else
|
|
6226 |
pData->iDISCcount = pDISC->iCount;
|
|
6227 |
pData->pDISCids = pDISC->pIds;
|
|
6228 |
|
|
6229 |
iRetcode = mng_process_display_disc (pData);
|
|
6230 |
#endif
|
|
6231 |
|
|
6232 |
#ifdef MNG_SUPPORT_TRACE
|
|
6233 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DISC, MNG_LC_END);
|
|
6234 |
#endif
|
|
6235 |
|
|
6236 |
return iRetcode;
|
|
6237 |
}
|
|
6238 |
#endif
|
|
6239 |
|
|
6240 |
/* ************************************************************************** */
|
|
6241 |
/* ************************************************************************** */
|
|
6242 |
|
|
6243 |
#ifdef MNG_SUPPORT_DYNAMICMNG
|
|
6244 |
|
|
6245 |
/* ************************************************************************** */
|
|
6246 |
|
|
6247 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6248 |
mng_retcode mng_create_event (mng_datap pData,
|
|
6249 |
mng_uint8 iEventtype,
|
|
6250 |
mng_uint8 iMasktype,
|
|
6251 |
mng_int32 iLeft,
|
|
6252 |
mng_int32 iRight,
|
|
6253 |
mng_int32 iTop,
|
|
6254 |
mng_int32 iBottom,
|
|
6255 |
mng_uint16 iObjectid,
|
|
6256 |
mng_uint8 iIndex,
|
|
6257 |
mng_uint32 iSegmentnamesize,
|
|
6258 |
mng_pchar zSegmentname)
|
|
6259 |
#else
|
|
6260 |
mng_retcode mng_create_event (mng_datap pData,
|
|
6261 |
mng_ptr pEntry)
|
|
6262 |
#endif
|
|
6263 |
{
|
|
6264 |
mng_eventp pEvent;
|
|
6265 |
|
|
6266 |
#ifdef MNG_SUPPORT_TRACE
|
|
6267 |
MNG_TRACE (pData, MNG_FN_CREATE_EVENT, MNG_LC_START);
|
|
6268 |
#endif
|
|
6269 |
|
|
6270 |
if (pData->bCacheplayback) /* caching playback info ? */
|
|
6271 |
{
|
|
6272 |
mng_object_headerp pLast;
|
|
6273 |
|
|
6274 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6275 |
mng_ptr pTemp;
|
|
6276 |
mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_event),
|
|
6277 |
mng_free_event,
|
|
6278 |
mng_process_event,
|
|
6279 |
&pTemp);
|
|
6280 |
if (iRetcode)
|
|
6281 |
return iRetcode;
|
|
6282 |
pEvent = (mng_eventp)pTemp;
|
|
6283 |
#else
|
|
6284 |
MNG_ALLOC (pData, pEvent, sizeof (mng_event));
|
|
6285 |
|
|
6286 |
pEvent->sHeader.fCleanup = mng_free_event;
|
|
6287 |
pEvent->sHeader.fProcess = mng_process_event;
|
|
6288 |
#endif
|
|
6289 |
|
|
6290 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6291 |
pEvent->iEventtype = iEventtype;
|
|
6292 |
pEvent->iMasktype = iMasktype;
|
|
6293 |
pEvent->iLeft = iLeft;
|
|
6294 |
pEvent->iRight = iRight;
|
|
6295 |
pEvent->iTop = iTop;
|
|
6296 |
pEvent->iBottom = iBottom;
|
|
6297 |
pEvent->iObjectid = iObjectid;
|
|
6298 |
pEvent->iIndex = iIndex;
|
|
6299 |
pEvent->iSegmentnamesize = iSegmentnamesize;
|
|
6300 |
|
|
6301 |
if (iSegmentnamesize)
|
|
6302 |
{
|
|
6303 |
MNG_ALLOC (pData, pEvent->zSegmentname, iSegmentnamesize+1);
|
|
6304 |
MNG_COPY (pEvent->zSegmentname, zSegmentname, iSegmentnamesize);
|
|
6305 |
}
|
|
6306 |
#else
|
|
6307 |
pEvent->iEventtype = ((mng_evnt_entryp)pEntry)->iEventtype;
|
|
6308 |
pEvent->iMasktype = ((mng_evnt_entryp)pEntry)->iMasktype;
|
|
6309 |
pEvent->iLeft = ((mng_evnt_entryp)pEntry)->iLeft;
|
|
6310 |
pEvent->iRight = ((mng_evnt_entryp)pEntry)->iRight;
|
|
6311 |
pEvent->iTop = ((mng_evnt_entryp)pEntry)->iTop;
|
|
6312 |
pEvent->iBottom = ((mng_evnt_entryp)pEntry)->iBottom;
|
|
6313 |
pEvent->iObjectid = ((mng_evnt_entryp)pEntry)->iObjectid;
|
|
6314 |
pEvent->iIndex = ((mng_evnt_entryp)pEntry)->iIndex;
|
|
6315 |
pEvent->iSegmentnamesize = ((mng_evnt_entryp)pEntry)->iSegmentnamesize;
|
|
6316 |
|
|
6317 |
if (pEvent->iSegmentnamesize)
|
|
6318 |
{
|
|
6319 |
MNG_ALLOC (pData, pEvent->zSegmentname, pEvent->iSegmentnamesize+1);
|
|
6320 |
MNG_COPY (pEvent->zSegmentname, ((mng_evnt_entryp)pEntry)->zSegmentname, pEvent->iSegmentnamesize);
|
|
6321 |
}
|
|
6322 |
#endif
|
|
6323 |
/* fixup the double-linked list */
|
|
6324 |
pLast = (mng_object_headerp)pData->pLastevent;
|
|
6325 |
|
|
6326 |
if (pLast) /* link it as last in the chain */
|
|
6327 |
{
|
|
6328 |
pEvent->sHeader.pPrev = pLast;
|
|
6329 |
pLast->pNext = pEvent;
|
|
6330 |
}
|
|
6331 |
else
|
|
6332 |
{
|
|
6333 |
pData->pFirstevent = pEvent;
|
|
6334 |
}
|
|
6335 |
|
|
6336 |
pData->pLastevent = pEvent;
|
|
6337 |
pData->bDynamic = MNG_TRUE;
|
|
6338 |
}
|
|
6339 |
|
|
6340 |
#ifdef MNG_SUPPORT_TRACE
|
|
6341 |
MNG_TRACE (pData, MNG_FN_CREATE_EVENT, MNG_LC_END);
|
|
6342 |
#endif
|
|
6343 |
|
|
6344 |
return MNG_NOERROR;
|
|
6345 |
}
|
|
6346 |
|
|
6347 |
/* ************************************************************************** */
|
|
6348 |
|
|
6349 |
mng_retcode mng_free_event (mng_datap pData,
|
|
6350 |
mng_objectp pObject)
|
|
6351 |
{
|
|
6352 |
mng_eventp pEvent = (mng_eventp)pObject;
|
|
6353 |
|
|
6354 |
#ifdef MNG_SUPPORT_TRACE
|
|
6355 |
MNG_TRACE (pData, MNG_FN_FREE_EVENT, MNG_LC_START);
|
|
6356 |
#endif
|
|
6357 |
|
|
6358 |
if (pEvent->iSegmentnamesize)
|
|
6359 |
MNG_FREEX (pData, pEvent->zSegmentname, pEvent->iSegmentnamesize + 1);
|
|
6360 |
|
|
6361 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6362 |
MNG_FREEX (pData, pEvent, sizeof (mng_event));
|
|
6363 |
#endif
|
|
6364 |
|
|
6365 |
#ifdef MNG_SUPPORT_TRACE
|
|
6366 |
MNG_TRACE (pData, MNG_FN_FREE_EVENT, MNG_LC_END);
|
|
6367 |
#endif
|
|
6368 |
|
|
6369 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6370 |
return MNG_NOERROR;
|
|
6371 |
#else
|
|
6372 |
return mng_free_obj_general(pData, pObject);
|
|
6373 |
#endif
|
|
6374 |
}
|
|
6375 |
|
|
6376 |
/* ************************************************************************** */
|
|
6377 |
|
|
6378 |
mng_retcode mng_process_event (mng_datap pData,
|
|
6379 |
mng_objectp pObject)
|
|
6380 |
{
|
|
6381 |
#ifndef MNG_SKIPCHUNK_SEEK
|
|
6382 |
mng_eventp pEvent = (mng_eventp)pObject;
|
|
6383 |
mng_object_headerp pAni;
|
|
6384 |
mng_bool bFound = MNG_FALSE;
|
|
6385 |
#endif
|
|
6386 |
|
|
6387 |
#ifdef MNG_SUPPORT_TRACE
|
|
6388 |
MNG_TRACE (pData, MNG_FN_PROCESS_EVENT, MNG_LC_START);
|
|
6389 |
#endif
|
|
6390 |
|
|
6391 |
#ifndef MNG_SKIPCHUNK_SEEK
|
|
6392 |
if (!pEvent->pSEEK) /* need to find SEEK first ? */
|
|
6393 |
{
|
|
6394 |
pAni = (mng_object_headerp)pData->pFirstaniobj;
|
|
6395 |
|
|
6396 |
while ((pAni) && (!bFound))
|
|
6397 |
{
|
|
6398 |
if ((pAni->fCleanup == mng_free_ani_seek) &&
|
|
6399 |
(strcmp(pEvent->zSegmentname, ((mng_ani_seekp)pAni)->zSegmentname) == 0))
|
|
6400 |
bFound = MNG_TRUE;
|
|
6401 |
else
|
|
6402 |
pAni = (mng_object_headerp)pAni->pNext;
|
|
6403 |
}
|
|
6404 |
|
|
6405 |
if (pAni)
|
|
6406 |
pEvent->pSEEK = (mng_ani_seekp)pAni;
|
|
6407 |
}
|
|
6408 |
|
|
6409 |
if (pEvent->pSEEK) /* anything to do ? */
|
|
6410 |
{
|
|
6411 |
pEvent->iLastx = pData->iEventx;
|
|
6412 |
pEvent->iLasty = pData->iEventy;
|
|
6413 |
/* let's start from this SEEK then */
|
|
6414 |
pData->pCurraniobj = (mng_objectp)pEvent->pSEEK;
|
|
6415 |
pData->bRunningevent = MNG_TRUE;
|
|
6416 |
/* wake-up the app ! */
|
|
6417 |
if (!pData->fSettimer ((mng_handle)pData, 5))
|
|
6418 |
MNG_ERROR (pData, MNG_APPTIMERERROR);
|
|
6419 |
|
|
6420 |
}
|
|
6421 |
else
|
|
6422 |
MNG_ERROR (pData, MNG_SEEKNOTFOUND);
|
|
6423 |
#endif
|
|
6424 |
|
|
6425 |
#ifdef MNG_SUPPORT_TRACE
|
|
6426 |
MNG_TRACE (pData, MNG_FN_PROCESS_EVENT, MNG_LC_END);
|
|
6427 |
#endif
|
|
6428 |
|
|
6429 |
return MNG_NOERROR;
|
|
6430 |
}
|
|
6431 |
|
|
6432 |
/* ************************************************************************** */
|
|
6433 |
|
|
6434 |
#endif /* MNG_SUPPORT_DYNAMICMNG */
|
|
6435 |
|
|
6436 |
/* ************************************************************************** */
|
|
6437 |
/* ************************************************************************** */
|
|
6438 |
|
|
6439 |
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
|
|
6440 |
|
|
6441 |
/* ************************************************************************** */
|
|
6442 |
|
|
6443 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6444 |
mng_retcode mng_create_mpng_obj (mng_datap pData,
|
|
6445 |
mng_uint32 iFramewidth,
|
|
6446 |
mng_uint32 iFrameheight,
|
|
6447 |
mng_uint16 iNumplays,
|
|
6448 |
mng_uint16 iTickspersec,
|
|
6449 |
mng_uint32 iFramessize,
|
|
6450 |
mng_ptr pFrames)
|
|
6451 |
#else
|
|
6452 |
mng_retcode mng_create_mpng_obj (mng_datap pData,
|
|
6453 |
mng_ptr pEntry)
|
|
6454 |
#endif
|
|
6455 |
{
|
|
6456 |
mng_mpng_objp pMPNG;
|
|
6457 |
mng_ptr pTemp;
|
|
6458 |
mng_retcode iRetcode;
|
|
6459 |
mng_uint8p pFrame;
|
|
6460 |
mng_int32 iCnt, iMax;
|
|
6461 |
mng_uint32 iX, iY, iWidth, iHeight;
|
|
6462 |
mng_int32 iXoffset, iYoffset;
|
|
6463 |
mng_uint16 iTicks;
|
|
6464 |
mng_uint16 iDelay;
|
|
6465 |
mng_bool bNewframe;
|
|
6466 |
mng_ani_loopp pLOOP;
|
|
6467 |
mng_ani_endlp pENDL;
|
|
6468 |
mng_ani_framp pFRAM;
|
|
6469 |
mng_ani_movep pMOVE;
|
|
6470 |
mng_ani_clipp pCLIP;
|
|
6471 |
mng_ani_showp pSHOW;
|
|
6472 |
|
|
6473 |
#ifdef MNG_SUPPORT_TRACE
|
|
6474 |
MNG_TRACE (pData, MNG_FN_CREATE_MPNG_OBJ, MNG_LC_START);
|
|
6475 |
#endif
|
|
6476 |
|
|
6477 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6478 |
iRetcode = create_obj_general (pData, sizeof (mng_mpng_obj), mng_free_mpng_obj,
|
|
6479 |
mng_process_mpng_obj, &pTemp);
|
|
6480 |
if (iRetcode)
|
|
6481 |
return iRetcode;
|
|
6482 |
pMPNG = (mng_mpng_objp)pTemp;
|
|
6483 |
#else
|
|
6484 |
MNG_ALLOC (pData, pMPNG, sizeof (mng_mpng_obj));
|
|
6485 |
|
|
6486 |
pMPNG->sHeader.fCleanup = mng_free_mpng_obj;
|
|
6487 |
pMPNG->sHeader.fProcess = mng_process_mpng_obj;
|
|
6488 |
#endif
|
|
6489 |
|
|
6490 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6491 |
pMPNG->iFramewidth = iFramewidth;
|
|
6492 |
pMPNG->iFrameheight = iFrameheight;
|
|
6493 |
pMPNG->iNumplays = iNumplays;
|
|
6494 |
pMPNG->iTickspersec = iTickspersec;
|
|
6495 |
pMPNG->iFramessize = iFramessize;
|
|
6496 |
|
|
6497 |
if (iFramessize)
|
|
6498 |
{
|
|
6499 |
MNG_ALLOC (pData, pMPNG->pFrames, iFramessize);
|
|
6500 |
MNG_COPY (pMPNG->pFrames, pFrames, iFramessize);
|
|
6501 |
}
|
|
6502 |
#else
|
|
6503 |
pMPNG->iFramewidth = ((mng_mpngp)pEntry)->iFramewidth;
|
|
6504 |
pMPNG->iFrameheight = ((mng_mpngp)pEntry)->iFrameheight;
|
|
6505 |
pMPNG->iNumplays = ((mng_mpngp)pEntry)->iNumplays;
|
|
6506 |
pMPNG->iTickspersec = ((mng_mpngp)pEntry)->iTickspersec;
|
|
6507 |
pMPNG->iFramessize = ((mng_mpngp)pEntry)->iFramessize;
|
|
6508 |
|
|
6509 |
if (pMPNG->iFramessize)
|
|
6510 |
{
|
|
6511 |
MNG_ALLOC (pData, pMPNG->pFrames, pMPNG->iFramessize);
|
|
6512 |
MNG_COPY (pMPNG->pFrames, ((mng_mpngp)pEntry)->pFrames, pMPNG->iFramessize);
|
|
6513 |
}
|
|
6514 |
#endif
|
|
6515 |
|
|
6516 |
pData->pMPNG = pMPNG;
|
|
6517 |
pData->eImagetype = mng_it_mpng;
|
|
6518 |
|
|
6519 |
iRetcode = mng_process_display_mpng (pData);
|
|
6520 |
if (iRetcode)
|
|
6521 |
return iRetcode;
|
|
6522 |
|
|
6523 |
/* now let's create the MNG animation directives from this */
|
|
6524 |
|
|
6525 |
pFrame = (mng_uint8p)pMPNG->pFrames;
|
|
6526 |
iMax = pMPNG->iFramessize / 26;
|
|
6527 |
/* set up MNG impersonation */
|
|
6528 |
pData->iTicks = pMPNG->iTickspersec;
|
|
6529 |
pData->iLayercount = iMax;
|
|
6530 |
|
|
6531 |
if (pMPNG->iNumplays != 1) /* create a LOOP/ENDL pair ? */
|
|
6532 |
{
|
|
6533 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6534 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_loop),
|
|
6535 |
mng_free_ani_loop, mng_process_ani_loop,
|
|
6536 |
&((mng_ptr)pLOOP));
|
|
6537 |
if (iRetcode)
|
|
6538 |
return iRetcode;
|
|
6539 |
#else
|
|
6540 |
MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop));
|
|
6541 |
|
|
6542 |
pLOOP->sHeader.fCleanup = mng_free_ani_loop;
|
|
6543 |
pLOOP->sHeader.fProcess = mng_process_ani_loop;
|
|
6544 |
#endif
|
|
6545 |
|
|
6546 |
pLOOP->iLevel = 1;
|
|
6547 |
if (pMPNG->iNumplays)
|
|
6548 |
pLOOP->iRepeatcount = pMPNG->iNumplays;
|
|
6549 |
else
|
|
6550 |
pLOOP->iRepeatcount = 0xFFFFFFFFl;
|
|
6551 |
|
|
6552 |
mng_add_ani_object (pData, (mng_object_headerp)pLOOP);
|
|
6553 |
}
|
|
6554 |
|
|
6555 |
bNewframe = MNG_TRUE; /* create the frame display objects */
|
|
6556 |
|
|
6557 |
for (iCnt = 0; iCnt < iMax; iCnt++)
|
|
6558 |
{
|
|
6559 |
iX = mng_get_uint32 (pFrame);
|
|
6560 |
iY = mng_get_uint32 (pFrame+4);
|
|
6561 |
iWidth = mng_get_uint32 (pFrame+8);
|
|
6562 |
iHeight = mng_get_uint32 (pFrame+12);
|
|
6563 |
iXoffset = mng_get_int32 (pFrame+16);
|
|
6564 |
iYoffset = mng_get_int32 (pFrame+20);
|
|
6565 |
iTicks = mng_get_uint16 (pFrame+24);
|
|
6566 |
|
|
6567 |
iDelay = iTicks;
|
|
6568 |
if (!iDelay)
|
|
6569 |
{
|
|
6570 |
mng_uint8p pTemp = pFrame+26;
|
|
6571 |
mng_int32 iTemp = iCnt+1;
|
|
6572 |
|
|
6573 |
while ((iTemp < iMax) && (!iDelay))
|
|
6574 |
{
|
|
6575 |
iDelay = mng_get_uint16 (pTemp+24);
|
|
6576 |
pTemp += 26;
|
|
6577 |
iTemp++;
|
|
6578 |
}
|
|
6579 |
}
|
|
6580 |
|
|
6581 |
if (bNewframe)
|
|
6582 |
{
|
|
6583 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6584 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_fram),
|
|
6585 |
mng_free_obj_general, mng_process_ani_fram,
|
|
6586 |
&((mng_ptr)pFRAM));
|
|
6587 |
if (iRetcode)
|
|
6588 |
return iRetcode;
|
|
6589 |
#else
|
|
6590 |
MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram));
|
|
6591 |
|
|
6592 |
pFRAM->sHeader.fCleanup = mng_free_ani_fram;
|
|
6593 |
pFRAM->sHeader.fProcess = mng_process_ani_fram;
|
|
6594 |
#endif
|
|
6595 |
|
|
6596 |
pFRAM->iFramemode = 4;
|
|
6597 |
pFRAM->iChangedelay = 1;
|
|
6598 |
pFRAM->iDelay = iDelay;
|
|
6599 |
|
|
6600 |
mng_add_ani_object (pData, (mng_object_headerp)pFRAM);
|
|
6601 |
}
|
|
6602 |
|
|
6603 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6604 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_move),
|
|
6605 |
mng_free_obj_general,
|
|
6606 |
mng_process_ani_move,
|
|
6607 |
&((mng_ptr)pMOVE));
|
|
6608 |
if (iRetcode)
|
|
6609 |
return iRetcode;
|
|
6610 |
#else
|
|
6611 |
MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move));
|
|
6612 |
|
|
6613 |
pMOVE->sHeader.fCleanup = mng_free_ani_move;
|
|
6614 |
pMOVE->sHeader.fProcess = mng_process_ani_move;
|
|
6615 |
#endif
|
|
6616 |
|
|
6617 |
pMOVE->iLocax = iXoffset - (mng_int32)iX;
|
|
6618 |
pMOVE->iLocay = iYoffset - (mng_int32)iY;
|
|
6619 |
|
|
6620 |
mng_add_ani_object (pData, (mng_object_headerp)pMOVE);
|
|
6621 |
|
|
6622 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6623 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_clip),
|
|
6624 |
mng_free_obj_general,
|
|
6625 |
mng_process_ani_clip,
|
|
6626 |
&((mng_ptr)pCLIP));
|
|
6627 |
if (iRetcode)
|
|
6628 |
return iRetcode;
|
|
6629 |
#else
|
|
6630 |
MNG_ALLOC (pData, pCLIP, sizeof (mng_ani_clip));
|
|
6631 |
|
|
6632 |
pCLIP->sHeader.fCleanup = mng_free_ani_clip;
|
|
6633 |
pCLIP->sHeader.fProcess = mng_process_ani_clip;
|
|
6634 |
#endif
|
|
6635 |
|
|
6636 |
pCLIP->iClipl = iXoffset;
|
|
6637 |
pCLIP->iClipr = iXoffset + (mng_int32)iWidth;
|
|
6638 |
pCLIP->iClipt = iYoffset;
|
|
6639 |
pCLIP->iClipb = iYoffset + (mng_int32)iHeight;
|
|
6640 |
|
|
6641 |
mng_add_ani_object (pData, (mng_object_headerp)pCLIP);
|
|
6642 |
|
|
6643 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6644 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_show),
|
|
6645 |
mng_free_obj_general, mng_process_ani_show,
|
|
6646 |
&((mng_ptr)pSHOW));
|
|
6647 |
if (iRetcode)
|
|
6648 |
return iRetcode;
|
|
6649 |
#else
|
|
6650 |
MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show));
|
|
6651 |
|
|
6652 |
pSHOW->sHeader.fCleanup = mng_free_ani_show;
|
|
6653 |
pSHOW->sHeader.fProcess = mng_process_ani_show;
|
|
6654 |
#endif
|
|
6655 |
|
|
6656 |
mng_add_ani_object (pData, (mng_object_headerp)pSHOW);
|
|
6657 |
|
|
6658 |
bNewframe = (mng_bool)iTicks;
|
|
6659 |
pFrame += 26;
|
|
6660 |
}
|
|
6661 |
|
|
6662 |
if (pMPNG->iNumplays != 1) /* create a LOOP/ENDL pair ? */
|
|
6663 |
{
|
|
6664 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6665 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_endl),
|
|
6666 |
mng_free_obj_general, mng_process_ani_endl,
|
|
6667 |
&((mng_ptr)pENDL));
|
|
6668 |
if (iRetcode)
|
|
6669 |
return iRetcode;
|
|
6670 |
#else
|
|
6671 |
MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl));
|
|
6672 |
|
|
6673 |
pENDL->sHeader.fCleanup = mng_free_ani_endl;
|
|
6674 |
pENDL->sHeader.fProcess = mng_process_ani_endl;
|
|
6675 |
#endif
|
|
6676 |
|
|
6677 |
pENDL->iLevel = 1;
|
|
6678 |
|
|
6679 |
mng_add_ani_object (pData, (mng_object_headerp)pENDL);
|
|
6680 |
}
|
|
6681 |
|
|
6682 |
#ifdef MNG_SUPPORT_TRACE
|
|
6683 |
MNG_TRACE (pData, MNG_FN_CREATE_MPNG_OBJ, MNG_LC_END);
|
|
6684 |
#endif
|
|
6685 |
|
|
6686 |
return MNG_NOERROR;
|
|
6687 |
}
|
|
6688 |
|
|
6689 |
/* ************************************************************************** */
|
|
6690 |
|
|
6691 |
mng_retcode mng_free_mpng_obj (mng_datap pData,
|
|
6692 |
mng_objectp pObject)
|
|
6693 |
{
|
|
6694 |
mng_mpng_objp pMPNG = (mng_mpng_objp)pObject;
|
|
6695 |
|
|
6696 |
#ifdef MNG_SUPPORT_TRACE
|
|
6697 |
MNG_TRACE (pData, MNG_FN_FREE_MPNG_OBJ, MNG_LC_START);
|
|
6698 |
#endif
|
|
6699 |
|
|
6700 |
if (pMPNG->iFramessize)
|
|
6701 |
MNG_FREEX (pData, pMPNG->pFrames, pMPNG->iFramessize);
|
|
6702 |
|
|
6703 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6704 |
MNG_FREEX (pData, pMPNG, sizeof (mng_mpng_obj));
|
|
6705 |
#endif
|
|
6706 |
|
|
6707 |
#ifdef MNG_SUPPORT_TRACE
|
|
6708 |
MNG_TRACE (pData, MNG_FN_FREE_MPNG_OBJ, MNG_LC_END);
|
|
6709 |
#endif
|
|
6710 |
|
|
6711 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6712 |
return MNG_NOERROR;
|
|
6713 |
#else
|
|
6714 |
return mng_free_obj_general(pData, pObject);
|
|
6715 |
#endif
|
|
6716 |
}
|
|
6717 |
|
|
6718 |
/* ************************************************************************** */
|
|
6719 |
|
|
6720 |
mng_retcode mng_process_mpng_obj (mng_datap pData,
|
|
6721 |
mng_objectp pObject)
|
|
6722 |
{
|
|
6723 |
return MNG_NOERROR;
|
|
6724 |
}
|
|
6725 |
|
|
6726 |
/* ************************************************************************** */
|
|
6727 |
|
|
6728 |
#endif /* MNG_INCLUDE_MPNG_PROPOSAL */
|
|
6729 |
|
|
6730 |
/* ************************************************************************** */
|
|
6731 |
/* ************************************************************************** */
|
|
6732 |
|
|
6733 |
#ifdef MNG_INCLUDE_ANG_PROPOSAL
|
|
6734 |
|
|
6735 |
/* ************************************************************************** */
|
|
6736 |
|
|
6737 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6738 |
mng_retcode mng_create_ang_obj (mng_datap pData,
|
|
6739 |
mng_uint32 iNumframes,
|
|
6740 |
mng_uint32 iTickspersec,
|
|
6741 |
mng_uint32 iNumplays,
|
|
6742 |
mng_uint32 iTilewidth,
|
|
6743 |
mng_uint32 iTileheight,
|
|
6744 |
mng_uint8 iInterlace,
|
|
6745 |
mng_uint8 iStillused)
|
|
6746 |
#else
|
|
6747 |
mng_retcode mng_create_ang_obj (mng_datap pData,
|
|
6748 |
mng_ptr pEntry)
|
|
6749 |
#endif
|
|
6750 |
{
|
|
6751 |
mng_ang_objp pANG;
|
|
6752 |
mng_ptr pTemp;
|
|
6753 |
mng_retcode iRetcode;
|
|
6754 |
|
|
6755 |
#ifdef MNG_SUPPORT_TRACE
|
|
6756 |
MNG_TRACE (pData, MNG_FN_CREATE_ANG_OBJ, MNG_LC_START);
|
|
6757 |
#endif
|
|
6758 |
|
|
6759 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6760 |
iRetcode = create_obj_general (pData, sizeof (mng_ang_obj), mng_free_ang_obj,
|
|
6761 |
mng_process_ang_obj, &pTemp);
|
|
6762 |
if (iRetcode)
|
|
6763 |
return iRetcode;
|
|
6764 |
pANG = (mng_ang_objp)pTemp;
|
|
6765 |
#else
|
|
6766 |
MNG_ALLOC (pData, pANG, sizeof (mng_ang_obj));
|
|
6767 |
|
|
6768 |
pANG->sHeader.fCleanup = mng_free_ang_obj;
|
|
6769 |
pANG->sHeader.fProcess = mng_process_ang_obj;
|
|
6770 |
#endif
|
|
6771 |
|
|
6772 |
#ifndef MNG_OPTIMIZE_CHUNKREADER
|
|
6773 |
pANG->iNumframes = iNumframes;
|
|
6774 |
pANG->iTickspersec = iTickspersec;
|
|
6775 |
pANG->iNumplays = iNumplays;
|
|
6776 |
pANG->iTilewidth = iTilewidth;
|
|
6777 |
pANG->iTileheight = iTileheight;
|
|
6778 |
pANG->iInterlace = iInterlace;
|
|
6779 |
pANG->iStillused = iStillused;
|
|
6780 |
#else
|
|
6781 |
pANG->iNumframes = ((mng_ahdrp)pEntry)->iNumframes;
|
|
6782 |
pANG->iTickspersec = ((mng_ahdrp)pEntry)->iTickspersec;
|
|
6783 |
pANG->iNumplays = ((mng_ahdrp)pEntry)->iNumplays;
|
|
6784 |
pANG->iTilewidth = ((mng_ahdrp)pEntry)->iTilewidth;
|
|
6785 |
pANG->iTileheight = ((mng_ahdrp)pEntry)->iTileheight;
|
|
6786 |
pANG->iInterlace = ((mng_ahdrp)pEntry)->iInterlace;
|
|
6787 |
pANG->iStillused = ((mng_ahdrp)pEntry)->iStillused;
|
|
6788 |
#endif
|
|
6789 |
|
|
6790 |
pData->pANG = pANG;
|
|
6791 |
pData->eImagetype = mng_it_ang;
|
|
6792 |
|
|
6793 |
iRetcode = mng_process_display_ang (pData);
|
|
6794 |
if (iRetcode)
|
|
6795 |
return iRetcode;
|
|
6796 |
|
|
6797 |
#ifdef MNG_SUPPORT_TRACE
|
|
6798 |
MNG_TRACE (pData, MNG_FN_CREATE_ANG_OBJ, MNG_LC_END);
|
|
6799 |
#endif
|
|
6800 |
|
|
6801 |
return MNG_NOERROR;
|
|
6802 |
}
|
|
6803 |
|
|
6804 |
/* ************************************************************************** */
|
|
6805 |
|
|
6806 |
mng_retcode mng_free_ang_obj (mng_datap pData,
|
|
6807 |
mng_objectp pObject)
|
|
6808 |
{
|
|
6809 |
mng_ang_objp pANG = (mng_ang_objp)pObject;
|
|
6810 |
|
|
6811 |
#ifdef MNG_SUPPORT_TRACE
|
|
6812 |
MNG_TRACE (pData, MNG_FN_FREE_ANG_OBJ, MNG_LC_START);
|
|
6813 |
#endif
|
|
6814 |
|
|
6815 |
if (pANG->iTilessize)
|
|
6816 |
MNG_FREEX (pData, pANG->pTiles, pANG->iTilessize);
|
|
6817 |
|
|
6818 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6819 |
MNG_FREEX (pData, pANG, sizeof (mng_ang_obj));
|
|
6820 |
#endif
|
|
6821 |
|
|
6822 |
#ifdef MNG_SUPPORT_TRACE
|
|
6823 |
MNG_TRACE (pData, MNG_FN_FREE_ANG_OBJ, MNG_LC_END);
|
|
6824 |
#endif
|
|
6825 |
|
|
6826 |
#ifndef MNG_OPTIMIZE_OBJCLEANUP
|
|
6827 |
return MNG_NOERROR;
|
|
6828 |
#else
|
|
6829 |
return mng_free_obj_general(pData, pObject);
|
|
6830 |
#endif
|
|
6831 |
}
|
|
6832 |
|
|
6833 |
/* ************************************************************************** */
|
|
6834 |
|
|
6835 |
mng_retcode mng_process_ang_obj (mng_datap pData,
|
|
6836 |
mng_objectp pObject)
|
|
6837 |
{
|
|
6838 |
mng_ang_objp pANG = (mng_ang_objp)pObject;
|
|
6839 |
mng_uint8p pTile = (mng_uint8p)pANG->pTiles;
|
|
6840 |
mng_retcode iRetcode;
|
|
6841 |
mng_int32 iCnt, iMax;
|
|
6842 |
mng_uint32 iTicks;
|
|
6843 |
mng_int32 iXoffset, iYoffset;
|
|
6844 |
mng_uint8 iSource;
|
|
6845 |
mng_ani_loopp pLOOP;
|
|
6846 |
mng_ani_endlp pENDL;
|
|
6847 |
mng_ani_framp pFRAM;
|
|
6848 |
mng_ani_movep pMOVE;
|
|
6849 |
mng_ani_showp pSHOW;
|
|
6850 |
|
|
6851 |
#ifdef MNG_SUPPORT_TRACE
|
|
6852 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANG_OBJ, MNG_LC_START);
|
|
6853 |
#endif
|
|
6854 |
|
|
6855 |
/* let's create the MNG animation directives from this */
|
|
6856 |
|
|
6857 |
iMax = pANG->iNumframes;
|
|
6858 |
/* set up MNG impersonation */
|
|
6859 |
pData->iTicks = pANG->iTickspersec;
|
|
6860 |
pData->iLayercount = iMax;
|
|
6861 |
|
|
6862 |
if (pANG->iNumplays != 1) /* create a LOOP/ENDL pair ? */
|
|
6863 |
{
|
|
6864 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6865 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_loop),
|
|
6866 |
mng_free_ani_loop, mng_process_ani_loop,
|
|
6867 |
&((mng_ptr)pLOOP));
|
|
6868 |
if (iRetcode)
|
|
6869 |
return iRetcode;
|
|
6870 |
#else
|
|
6871 |
MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop));
|
|
6872 |
|
|
6873 |
pLOOP->sHeader.fCleanup = mng_free_ani_loop;
|
|
6874 |
pLOOP->sHeader.fProcess = mng_process_ani_loop;
|
|
6875 |
#endif
|
|
6876 |
|
|
6877 |
pLOOP->iLevel = 1;
|
|
6878 |
if (pANG->iNumplays)
|
|
6879 |
pLOOP->iRepeatcount = pANG->iNumplays;
|
|
6880 |
else
|
|
6881 |
pLOOP->iRepeatcount = 0xFFFFFFFFl;
|
|
6882 |
|
|
6883 |
mng_add_ani_object (pData, (mng_object_headerp)pLOOP);
|
|
6884 |
}
|
|
6885 |
|
|
6886 |
for (iCnt = 0; iCnt < iMax; iCnt++)
|
|
6887 |
{
|
|
6888 |
iTicks = mng_get_uint32 (pTile);
|
|
6889 |
iXoffset = mng_get_int32 (pTile+4);
|
|
6890 |
iYoffset = mng_get_int32 (pTile+8);
|
|
6891 |
iSource = *(pTile+12);
|
|
6892 |
|
|
6893 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6894 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_fram),
|
|
6895 |
mng_free_obj_general, mng_process_ani_fram,
|
|
6896 |
&((mng_ptr)pFRAM));
|
|
6897 |
if (iRetcode)
|
|
6898 |
return iRetcode;
|
|
6899 |
#else
|
|
6900 |
MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram));
|
|
6901 |
|
|
6902 |
pFRAM->sHeader.fCleanup = mng_free_ani_fram;
|
|
6903 |
pFRAM->sHeader.fProcess = mng_process_ani_fram;
|
|
6904 |
#endif
|
|
6905 |
|
|
6906 |
pFRAM->iFramemode = 4;
|
|
6907 |
pFRAM->iChangedelay = 1;
|
|
6908 |
pFRAM->iDelay = iTicks;
|
|
6909 |
|
|
6910 |
mng_add_ani_object (pData, (mng_object_headerp)pFRAM);
|
|
6911 |
|
|
6912 |
if (!iSource)
|
|
6913 |
{
|
|
6914 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6915 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_move),
|
|
6916 |
mng_free_obj_general,
|
|
6917 |
mng_process_ani_move,
|
|
6918 |
&((mng_ptr)pMOVE));
|
|
6919 |
if (iRetcode)
|
|
6920 |
return iRetcode;
|
|
6921 |
#else
|
|
6922 |
MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move));
|
|
6923 |
|
|
6924 |
pMOVE->sHeader.fCleanup = mng_free_ani_move;
|
|
6925 |
pMOVE->sHeader.fProcess = mng_process_ani_move;
|
|
6926 |
#endif
|
|
6927 |
|
|
6928 |
pMOVE->iFirstid = 1;
|
|
6929 |
pMOVE->iLastid = 1;
|
|
6930 |
pMOVE->iLocax = -iXoffset;
|
|
6931 |
pMOVE->iLocay = -iYoffset;
|
|
6932 |
|
|
6933 |
mng_add_ani_object (pData, (mng_object_headerp)pMOVE);
|
|
6934 |
}
|
|
6935 |
|
|
6936 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6937 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_show),
|
|
6938 |
mng_free_obj_general, mng_process_ani_show,
|
|
6939 |
&((mng_ptr)pSHOW));
|
|
6940 |
if (iRetcode)
|
|
6941 |
return iRetcode;
|
|
6942 |
#else
|
|
6943 |
MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show));
|
|
6944 |
|
|
6945 |
pSHOW->sHeader.fCleanup = mng_free_ani_show;
|
|
6946 |
pSHOW->sHeader.fProcess = mng_process_ani_show;
|
|
6947 |
#endif
|
|
6948 |
|
|
6949 |
if (iSource)
|
|
6950 |
pSHOW->iFirstid = 0;
|
|
6951 |
else
|
|
6952 |
pSHOW->iFirstid = 1;
|
|
6953 |
pSHOW->iLastid = pSHOW->iFirstid;
|
|
6954 |
|
|
6955 |
mng_add_ani_object (pData, (mng_object_headerp)pSHOW);
|
|
6956 |
|
|
6957 |
pTile += sizeof(mng_adat_tile);
|
|
6958 |
}
|
|
6959 |
|
|
6960 |
if (pANG->iNumplays != 1) /* create a LOOP/ENDL pair ? */
|
|
6961 |
{
|
|
6962 |
#ifdef MNG_OPTIMIZE_OBJCLEANUP
|
|
6963 |
iRetcode = create_obj_general (pData, sizeof (mng_ani_endl),
|
|
6964 |
mng_free_obj_general, mng_process_ani_endl,
|
|
6965 |
&((mng_ptr)pENDL));
|
|
6966 |
if (iRetcode)
|
|
6967 |
return iRetcode;
|
|
6968 |
#else
|
|
6969 |
MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl));
|
|
6970 |
|
|
6971 |
pENDL->sHeader.fCleanup = mng_free_ani_endl;
|
|
6972 |
pENDL->sHeader.fProcess = mng_process_ani_endl;
|
|
6973 |
#endif
|
|
6974 |
|
|
6975 |
pENDL->iLevel = 1;
|
|
6976 |
|
|
6977 |
mng_add_ani_object (pData, (mng_object_headerp)pENDL);
|
|
6978 |
}
|
|
6979 |
|
|
6980 |
#ifdef MNG_SUPPORT_TRACE
|
|
6981 |
MNG_TRACE (pData, MNG_FN_PROCESS_ANG_OBJ, MNG_LC_END);
|
|
6982 |
#endif
|
|
6983 |
|
|
6984 |
return MNG_NOERROR;
|
|
6985 |
}
|
|
6986 |
|
|
6987 |
/* ************************************************************************** */
|
|
6988 |
|
|
6989 |
#endif /* MNG_INCLUDE_ANG_PROPOSAL */
|
|
6990 |
|
|
6991 |
/* ************************************************************************** */
|
|
6992 |
|
|
6993 |
#endif /* MNG_INCLUDE_DISPLAY_PROCS */
|
|
6994 |
|
|
6995 |
/* ************************************************************************** */
|
|
6996 |
/* * end of file * */
|
|
6997 |
/* ************************************************************************** */
|
|
6998 |
|